Цитата(JackYF @ 28.10.2007, 19:01 ) | FILE* f = fopen("moidodir_journal.bin", "bw+"); fwrite(&i, sizeof(int), f); |
не совсем.
| Цитата(man fopen) | w+ Open for reading and writing. The file is created if it does not exist, otherwise it is truncated. The stream is positioned at the beginning of the file.
a Open for appending (writing at end of file). The file is cre‐ ated if it does not exist. The stream is positioned at the end of the file.
|
Цитата(meta @ 28.10.2007, 17:00 ) | | int file = open("moidodir_journal.bin", O_WRONLY | O_BINARY , S_WRITE); |
| Цитата(man 2 open) | O_APPEND The file is opened in append mode. Before each write(), the file offset is positioned at the end of the file, as if with lseek(). O_APPEND may lead to corrupted files on NFS file systems if more than one process appends data to a file at once. This is because NFS does not support appending to a file, so the client kernel has to simulate it, which can’t be done without a race condition.
|
|