Created
January 27, 2016 00:10
-
-
Save psxdev/7d046622a4fc40327d39 to your computer and use it in GitHub Desktop.
testing dir stat on win
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <psp2/moduleinfo.h> | |
#include <debugnet.h> | |
#include <psp2/io/fcntl.h> | |
#include <psp2/io/dirent.h> | |
#include <psp2link.h> | |
#define LOGLEVEL 3 | |
void debugNetUDPPrintf(const char* fmt, ...); | |
int main() | |
{ | |
int ret; | |
ret=psp2LinkInit("192.168.1.41", 0x4711,0x4712, 0x4712, LOGLEVEL); | |
while(!psp2LinkRequestsIsConnected()) | |
{ | |
} | |
int test_fd; | |
SceIoDirent dirent; | |
test_fd=psp2LinkIoDopen("host0:c:/"); | |
while (psp2LinkIoDread(test_fd, &dirent) > 0) | |
{ | |
// Output the mode information. | |
if (dirent.d_stat.st_mode & 0x4000) { debugNetUDPPrintf("l"); } else | |
if (dirent.d_stat.st_mode & 0x2000) { debugNetUDPPrintf("-"); } else | |
if (dirent.d_stat.st_mode & 0x1000) { debugNetUDPPrintf("d"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0100) { debugNetUDPPrintf("r"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0080) { debugNetUDPPrintf("w"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0040) { debugNetUDPPrintf("x"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0020) { debugNetUDPPrintf("r"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0010) { debugNetUDPPrintf("w"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0008) { debugNetUDPPrintf("x"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0004) { debugNetUDPPrintf("r"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0002) { debugNetUDPPrintf("w"); } else { debugNetUDPPrintf("-"); } | |
if (dirent.d_stat.st_mode & 0x0001) { debugNetUDPPrintf("x"); } else { debugNetUDPPrintf("-"); } | |
// Output the file size. | |
debugNetUDPPrintf(" %10d", (int)dirent.d_stat.st_size); | |
// Output the date. | |
debugNetUDPPrintf(" %02u-%02u-%04u", dirent.d_stat.st_mtime.day, dirent.d_stat.st_mtime.month, (dirent.d_stat.st_mtime.year)); | |
// Output the time. | |
debugNetUDPPrintf(" %02d:%02d:%02d", dirent.d_stat.st_mtime.hour, dirent.d_stat.st_mtime.minute, dirent.d_stat.st_mtime.second); | |
// Output the name. | |
debugNetUDPPrintf(" %s\n", dirent.d_name); | |
} | |
psp2LinkIoDclose(test_fd); | |
debugNetUDPPrintf("end \n"); | |
while(1) | |
{} | |
psp2LinkFinish(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment