Hallo pl,
Dateien werden immer sequentiell geschrieben.
Nein.
#include <stdio.h>
int main(void) {
FILE *fd = fopen("test.txt", "w");
fseek(fd, 4 * sizeof(char), SEEK_SET);
fwrite("bar\n", sizeof(char), 4, fd);
fflush(fd);
fseek(fd, 0, SEEK_SET);
fwrite("foo", sizeof(char), 3, fd);
fclose(fd);
return 0;
}
➜ ckruse@Pug ~ % gcc -Wall -ansi -pedantic -o test test.c
➜ ckruse@Pug ~ % ./test
➜ ckruse@Pug ~ % cat test.txt
foobar
➜ ckruse@Pug ~ %
LG,
CK