Hi guys im trying to get a program to read a file and copy its contents to another file so far I seem to be having a problem.
The file is only writing one letter, "X" in this case
Im just wondering what my problem is here?
the file im testing it on is just a massive text document, so there dhould be more than one letter comming out
Eventually im going to use this program to tidy up a text document with float values, that sounds confusing as I type it, but its just a text file with numeric data on it but its very messed up as it looks something like this
int main ( int argc, char *argv )
if ( argc != 2 )
printf( "usage: %s filename", argv );
FILE *file = fopen( argv, "r" );
if ( file == 0 )
printf( "Could not open file\n" );
while ( ( x = fgetc( file ) ) != EOF )
outf = fopen("test.txt","w");
fclose( file );
What I want to do is tidy it up so that there is only one space between each value and hopefully start a new line after every 10 numbers.
121.2 12.12 121.21 1.212
1.12 121 121 1 1.212 12.12 121.2 12