nichtswissender
June 12th, 2002, 06:45 AM
hi
i have a problem by writing into a file in binary mode...
i want to overwrite single characters in given positions...
so far iīm using that code:
FILE *out;
out = fopen(<filename>, "ab"); // a for append, b for binary
fseek (out, <intPosition>, SEEK_CUR);
fputc(<char>, out);
the problem with this technique is, that the code doesn't overwrite existing characters, but appends everything at the end of the file (although i have set the filepointer to the correct position)...
using "wb" instead of "ab" when opening the file results in overwriting the whole file...
does anybody know a correct (and maybe quick) way to handle this problem ?
thx a lot
nichtswissender (<-- knownothingman ;))
i have a problem by writing into a file in binary mode...
i want to overwrite single characters in given positions...
so far iīm using that code:
FILE *out;
out = fopen(<filename>, "ab"); // a for append, b for binary
fseek (out, <intPosition>, SEEK_CUR);
fputc(<char>, out);
the problem with this technique is, that the code doesn't overwrite existing characters, but appends everything at the end of the file (although i have set the filepointer to the correct position)...
using "wb" instead of "ab" when opening the file results in overwriting the whole file...
does anybody know a correct (and maybe quick) way to handle this problem ?
thx a lot
nichtswissender (<-- knownothingman ;))