[ create a new paste ] login | about

Link: http://codepad.org/xukGjotr    [ raw code | fork ]

C, pasted on Jun 9:
#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;
}


Create a new paste based on this one


Comments: