Note: I ran this on my PC and it works with the use of EOF and changing the file from "mc0:/Text.txt" to "Text.txt".
EDIT: Decided to use fread since it operates better for my purposes.
I am writing a function to read a line of 18 characters and split it into 9 each. Then having while loop print out each line on the screen. However, when I use 'EOF', it just keeps printing out lines as if there is no end of file. So, as my title suggests, is the PS2SDK compatible with EOF? If not, is there an alternative?
In case your wondering what keeps being written; I can't really make out what it is constantly printing on my TV, but if I run this on linux and change the EOF to NULL (So it wouldn't stop the loop), it prints the last line over and over again.
Thanks!
Code:
Text file:
EDIT: Decided to use fread since it operates better for my purposes.
I am writing a function to read a line of 18 characters and split it into 9 each. Then having while loop print out each line on the screen. However, when I use 'EOF', it just keeps printing out lines as if there is no end of file. So, as my title suggests, is the PS2SDK compatible with EOF? If not, is there an alternative?
In case your wondering what keeps being written; I can't really make out what it is constantly printing on my TV, but if I run this on linux and change the EOF to NULL (So it wouldn't stop the loop), it prints the last line over and over again.
Thanks!
Code:
Code:
char Address[9], Data[9];
FILE *fp;
fp = fopen("mc0:/Test.txt", "r");
if (fp < 0)
{
printf("Error, fp < 0");
return 0;
fclose(fp);
}
if (fp > 0)
{
while ( fscanf(fp, "%s %s", Address, Data) != EOF ) {
scr_printf("\n %s, %s \n\n", Address, Data);
}
fclose(fp);
}
Code:
12345678 87654321 87654321 12345678
Comment