build/api-examples/DirectoryListing.cpp¶
Complete program from the DirectoryListing API reference. Save it at the path shown above and use the build command in the reference page.
Source files · Download DirectoryListing.cpp
#include "desktop_native.hpp"
#include <cstdio>
#include <cstring>
int main()
{
gaspardos::desktop::NativeFileAccess access;
gaspardos::desktop::DirectoryListing listing(access);
if (!listing.begin("/AHCIDISK0"))
return 1;
for (unsigned i = 0; i < 10000 && listing.loading; ++i)
{
listing.tick();
GO64_yield();
}
return !listing.loading && listing.error == 0 ? 0 : 1;
}