tk5-c90-projects/src/TXTWKR01.c

26 lines
562 B
C
Raw Normal View History

#include <stdio.h>
int main()
{
2026-02-08 15:57:09 +00:00
printf((char *)"Program starting - about to fopen(dd:TESTDD, \"r\")\n");
2026-02-08 15:57:09 +00:00
FILE *fp;
char buf[256];
fp = fopen("dd:TESTDD", "r");
2026-02-08 15:43:02 +00:00
if (fp == NULL) {
2026-02-08 15:57:09 +00:00
printf((char *)"fopen returned NULL\n");
printf((char *)"fopen read failed\n");
return 1;
}
2026-02-08 15:57:09 +00:00
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;
2026-02-08 15:43:02 +00:00
}