B
buda
All error checking is removed for clarity. This turns into a infinite loop
that writes at the end of a file, and makes it grow until a "forced brake".
Thanks for the help (btw, both stdio.h and stdlib.h are included)
int zamijeni (char *ime_datoteke) {
FILE *fp;
int t, flag = 0;
fp = fopen( ime_datoteke, "r+b" );
while ( fread( (void *)&t, (long)sizeof( t ), 1, fp ) == 1 ) {
if ( t < 0 ) {
t = -t;
++flag;
fseek( fp, -1L * (long)sizeof( t ), SEEK_CUR );
fwrite( (void *)&t, (long)sizeof( t ), 1, fp );
}
}
return flag > 0;
}
that writes at the end of a file, and makes it grow until a "forced brake".
Thanks for the help (btw, both stdio.h and stdlib.h are included)
int zamijeni (char *ime_datoteke) {
FILE *fp;
int t, flag = 0;
fp = fopen( ime_datoteke, "r+b" );
while ( fread( (void *)&t, (long)sizeof( t ), 1, fp ) == 1 ) {
if ( t < 0 ) {
t = -t;
++flag;
fseek( fp, -1L * (long)sizeof( t ), SEEK_CUR );
fwrite( (void *)&t, (long)sizeof( t ), 1, fp );
}
}
return flag > 0;
}