reading and printing txt file to screen

lslf
Last edited on
stdlib.h, stdio.h, FILE, fopen, fscanf, fprintf and fclose are all C. If you want to use C++, read the site above.
OP:

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

int main()
{
FILE *file_in;
char string;
file_in = fopen("example.txt", "w");
fscanf(file_in, "%c", &string);
fprintf(file_in, "%c", string);
fclose(file_in);
return 0;


}

this is my code basically i want to print out what i have read from the txt file onto the screen how do i do it????????
Topic archived. No new replies allowed.