fpc/packages/libndsfpc/examples/filesystem/libfat/access_dir/access_dir.pp
Legolas 3f9327d340 * NDS: updated the rtl, libnds and fixed the examples. Now it should work fine with devkitARM r26
- Removed (again) old libgba examples

git-svn-id: trunk@13585 -
2009-08-23 13:57:45 +00:00

45 lines
786 B
ObjectPascal

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.