Solution for Exercise 22-5

ex2205

#include <stdio.h>
#include <stdlib.h>

int main()
{
    FILE *fh;

    fh=fopen("hello.txt","a");
    if(fh==NULL)
    {
        puts("Can't open that file!");
        exit(1);
    }
    fprintf(fh,"This text was added later\n");
    fclose(fh);
    return(0);
}

Notes

* A solution for the missing hello.txt file would be to copy it from one project folder to another. Or you can copy all the Code::Blocks executable files to the same folder and run everything there.