just trying to read a goddamned file
This commit is contained in:
parent
da147cd839
commit
c0ce8c08b0
@ -2,15 +2,25 @@
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
printf("Starting program - attempting fopen(dd:TESTDD, \"r\")\n");
|
printf((char *)"Program starting - about to fopen(dd:TESTDD, \"r\")\n");
|
||||||
|
|
||||||
FILE *fp = fopen("dd:TESTDD", "r");
|
FILE *fp;
|
||||||
|
char buf[256];
|
||||||
|
|
||||||
|
fp = fopen("dd:TESTDD", "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
printf("fopen returned NULL\n");
|
printf((char *)"fopen returned NULL\n");
|
||||||
perror("fopen error");
|
printf((char *)"fopen read failed\n");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("fopen succeeded!\n");
|
printf((char *)"fopen succeeded!\n");
|
||||||
/* rest unchanged */
|
printf((char *)"Existing content:\n");
|
||||||
|
while (fgets(buf, 256, fp) != NULL) {
|
||||||
|
printf((char *)"%s", buf);
|
||||||
|
}
|
||||||
|
fclose(fp);
|
||||||
|
|
||||||
|
printf((char *)"Read complete.\n");
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user