tk5-c90-projects/src/TXTWKR01.c
Greg Gauthier c0ce8c08b0
Some checks failed
MVS Delete Members / delete-members (push) Failing after 13s
MVS Submit & Execute / upload-and-run (push) Failing after 50s
just trying to read a goddamned file
2026-02-08 15:57:09 +00:00

26 lines
562 B
C

#include <stdio.h>
int main()
{
printf((char *)"Program starting - about to fopen(dd:TESTDD, \"r\")\n");
FILE *fp;
char buf[256];
fp = fopen("dd:TESTDD", "r");
if (fp == NULL) {
printf((char *)"fopen returned NULL\n");
printf((char *)"fopen read failed\n");
return 1;
}
printf((char *)"fopen succeeded!\n");
printf((char *)"Existing content:\n");
while (fgets(buf, 256, fp) != NULL) {
printf((char *)"%s", buf);
}
fclose(fp);
printf((char *)"Read complete.\n");
return 0;
}