Code: Select all
int main() {
/* SIZE is defined to be 256 earlier in the program. Changing this value
does not correct the problem */
char teststr[SIZE];
char teststr2[SIZE];
int fd;
int i;
//The file opened contains a 5-character string.
//I have also tried sceIoRead(fd, teststr, 5 * sizeof(char)); but it still did not work.
fd = sceIoOpen("ms0:/PSP/GAME/TEST/config", PSP_O_RDONLY, 0777);
sceIoRead(fd, teststr, 5);
sceIoClose(fd);
pgFillvram(0);
//Check and print length of string (for troubleshooting purposes)
i = strlen(teststr);
sprintf(teststr2, "%i", i);
pgPrint(0,29,0x7FFF,teststr2);
/*Print out string that was read in from file. This should just print the string, but it also fills the remainder of the screen with checkerboard-style characters (probably NULL characters, but I'm not sure) */
pgPrint(0,30,0x7FFF,teststr);
//Unrelated code here
}