All pastes #194188 Raw Edit

Anonymous

public c v1 · immutable
·published 2006-10-07 16:46 UTC
rendered paste body
char* outputString( char *source ) {	char *out, *name, *ext;		ext = strrchr( source, '.' );		if ( strcmp( ext, ".ppm" ) == 0 ) {		int name_length = strlen(source) - strlen(ext) + 1;		fprintf( stdout, "%i\n", name_length );			name = (char *) malloc( name_length * sizeof(char) ); 		strncpy( name, source, name_length-1 );		name[name_length-1] = 0;		fprintf( stdout, "%s\n", name );		out = strcat( name, ".pgm" );	} //else {		//out = strcat( source, ".pgm" );	//}	 	fprintf( stdout, "%s\n", out );		return out;}