|
#include <stdio.h>
void
main( int argc, char *argv[] )
{
FILE *fp;
char buffer[4096];
char out[80];
int i,j,len;
fp = fopen( argv[1], "rt" );
if ( fp == NULL ) {
printf( "error\n" );
exit( 1 );
}
while( 1 ) {
fgets( buffer, 4096, fp );
if ( feof( fp ) ) {
break;
}
len = strlen( buffer );
j = 0;
for( i = 0; i < len; i++ ) {
if ( buffer[i] != ',' ) {
out[j] = buffer[i];
j++;
}
else {
out[j] = 0x00;
printf( "%s\n", out );
j = 0;
}
}
j--;
out[j] = 0x00;
printf( "%s\n", out );
}
fclose( fp );
}
| |