blob: f8f924c7d9fdf4a7a80a912dbf96d090d0ac60e7 (
plain)
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
|
program access_dir;
{$mode objfpc}
uses
nds9, fat, ctypes;
var
i: integer;
filename: string[255];
handle: P_FILE;
st: stat;
dir: PDIR_ITER;
begin
consoleDemoInit();
printf('fatInit()...');
if (fatInitDefault()) then
begin
printf(#9 + 'Success' + #10);
dir := diropen('/');
if (dir = nil) then
iprintf ('Unable to open the directory.'#10)
else
begin
while dirnext(dir, pchar(@filename), @st) = 0 do
begin
// st.st_mode & _IFDIR indicates a directory
if (st.st_mode and $4000) <> 0 then
iprintf ('%s: %s'#10, ' DIR', pchar(@filename))
else
iprintf ('%s: %s'#10, 'FILE', pchar(@filename));
end;
end;
end else
printf(#9 + 'Failure' + #10);
while true do;
end.
|