#include <stdio.h>
#include <string.h>
int main( void )
{
FILE* file;
char buff[ 256 ];
size_t len;
file = fopen( "test.txt", "r" );
if( file )
{
fgets( buff, sizeof(buff), file );
fclose( file );
file = fopen( "sample.txt", "w" );
if( file )
{
len = strlen( buff );
for( int i = len - 1; i >= 0; --i )
{
fputc( buff[ i ], file );
}
fclose( file );
}
}
return 0;
}