thanks for the help. I got it to sorta work. I am still getting a "segmentation fault - core dumped" message tho.
Code:
while( fgets( ptrstr, 80, file ) != NULL )
{
delspace( ptrstr );
result = strcompare( ptrstr, ptroldstr );
printf( "%d%s", result, ptrstr );
fwrite( &result, sizeof( int ), 1, compfile );
fwrite( ptrstr, sizeof( char ), strlen( ptrstr ), compfile );
strcpy( ptroldstr, ptrstr );
puts( "I WANT MORE" );
}
puts( "I WANT EVEN MORE" );/*segmentation fault comes here*/
fclose( file );
fclose( compfile );
return 0;
}
The other thing is with strcpy in my compare function. It says:
deltest.c: In function `strcompare':
deltest.c:135: warning: passing arg 2 of `strcpy' makes pointer from integer without a cast
Code:
int strcompare( char *ptrstr, char *ptroldstr )
{
int i;
if( strlen( ptroldstr ) == 0 )
{
ptroldstr = ptrstr;
return 0;
}
for( i = 0; i < strlen( ptrstr ); ++i)
if( *( ptrstr + i ) != *( ptroldstr + i ) )
break;
ptroldstr = strcpy( ptrstr, ptrstr[ i ] );
return i;
}
I had that warning quite freqquently in earlier stages but I am not quite sure what thats supposed to mean for me?
Any hints, ideas appreciated. Cheers,
Johannes