i have got a program which loads a file and reads it in char buy char and then print it.
does anyone no how to change this program so it will store the char's into an array as they are being read.
Any help welcomeCode:#include <stdio.h>
int main ()
{
FILE *file = fopen( "key.txt", "r" );
if ( file == 0 )
{
printf( "Could not open file\n" );
}
else
{
int x;
while ( ( x = fgetc( file ) ) != EOF )
{
printf( "%c", x );
}
}
printf("\n");
if
fclose( file );
}