Wandbox
SettingsLog
SettingsLog
Language
GitHubLogin
Ran/Viewed Log

ofstream::write writes zeros for part of the file

https://stackoverflow.com/q/71615456/1387438

Language

C

Compiler

gcc 12.1.0

Options
Warnings
C11(GNU)
-pedantic-errors

ofstream::write writes zeros for part of the file

https://stackoverflow.com/q/71615456/1387438

data.txt

$ gcc prog.c -Wall -Wextra -std=gnu11 -pedantic-errors
before write ftell: 0
after write ftell: 52
after read ftell: 52    data read=0    file error:0    eof:1
after read from beggining ftell: 52    data read=52    file error:0    eof:1
Exit Code:
0