diff --git a/src/TXTWKR01.c b/src/TXTWKR01.c index f41e7cb..8586908 100644 --- a/src/TXTWKR01.c +++ b/src/TXTWKR01.c @@ -2,15 +2,25 @@ 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) { - printf("fopen returned NULL\n"); - perror("fopen error"); + printf((char *)"fopen returned NULL\n"); + printf((char *)"fopen read failed\n"); return 1; } - printf("fopen succeeded!\n"); - /* rest unchanged */ + 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; } \ No newline at end of file