fpc/packages/libndsfpc/examples/filesystem/libfat/access_dir/access_dir.pp
Legolas d2dabe9a33 * updated nds/gba linker scripts and reverted some changes for 2.2.4a release
- Removed unused/outdated stuff from libndsfpc
+ Added new examples for libndsfpc
+ Added working (I hope so...) makefile.fpc for all libndsfpc/libgbafpc examples

git-svn-id: trunk@13217 -
2009-05-31 12:15:24 +00:00

46 lines
802 B
ObjectPascal

program access_dir;
{$apptype arm9}
{$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.