hello.

i am working on the i/p file which will have object name=value.have any no of i/ps given by user.
the value has to be updated each time a new value is entered in CLI.
can i overwrite the value with some greater size value?????????????
without using the tepmfile??i understand the txt in file are continous streams of bytes in memory.
actaully i can overite but the next line is deleted if i use some graeter size value.
my code:

FSEEK(fp,pos,SEEK_SET);
fprint(buffer,"%s=%d",objct,value);
fputs(buffer,fp);


thanks..

Once text files are written you can not overwrite the data with larger amounts because it will overwrite other data that follows it. For example if the file contains "Hello world" and you want to change it to "Hello12 world" the result would be "Hello12orld", which ic clearly not what you want.

There are a couple ways to resolve the problem
(1) If the file is small, read the entire file into memory, make in-memory changes, then rewrite it back out.

(2) For large files you will want to use a temporary file, reading from original file and writing back to new temp file. When done, delete the original file and rename the temp file to the name of the original file.

BTW: The code you posted is not compilable.