-
Notifications
You must be signed in to change notification settings - Fork 9
/
testfile.c
48 lines (46 loc) · 1.5 KB
/
testfile.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
The contents of this file are subject to the "do whatever you like"-license.
That means: Do, whatver you want, this file is under public domain. It is an
example for sparrow3d. Copy it and learn from it for your project and release
it under every license you want. ;-)
For feedback and questions about my Files and Projects please mail me,
Alexander Matthes (Ziz) , zizsdl_at_googlemail.com
*/
#include <sparrow3d.h>
int main( int argc, char **argv )
{
//In this program we don't use sparrowCore functionalities, so no init functions.
printf("This program shows the sparrowFile functionality of getting directory content.\n");
printf("F = File\n");
printf("D = Direcotry\n");
printf("L = (Sym)link\n--------------------\n");
spFileListPointer list;
spFileError error = spFileGetDirectory(&list,".",1,1);
printf("Files: %i\n",list->count);
//spFileSortList(&list,SP_FILE_SORT_BY_TYPE_AND_NAME | SP_FILE_SORT_BACKWARDS);
spFileListPointer mom = list;
while (mom)
{
switch (mom->type)
{
case SP_FILE_FILE:
printf("F %s\n",mom->name);
break;
case SP_FILE_DIRECTORY:
printf("D %s\n",mom->name);
break;
case SP_FILE_FILE | SP_FILE_LINK:
printf("FL %s\n",mom->name);
break;
case SP_FILE_DIRECTORY | SP_FILE_LINK:
printf("DL %s\n",mom->name);
break;
}
printf(" Last mod: %s",ctime((time_t*)&mom->last_mod));
printf(" Last acc: %s",ctime((time_t*)&mom->last_acc));
mom = mom->next;
}
printf("Error: %i\n",error);
spFileDeleteList(list);
return 0;
}