bin vs dat

I cannot write as binary using .dat format in ubuntu, why?
I don't believe you.

Provide a minimal example that demonstrates your issue.
Last edited on
You have to be more specific. What is it that doesn't work? When you say the .dat format do you mean a particular file format or just a file name that ends with .dat?
1
2
3
4
5
6
7

int num=50;
file.open("binary.dat", ios::out|ios::binary);

while(j<1)

    file.write((char*)&num, sizeof(int)) //this does not write to binary.dat but if i change to bin it writes 
How did you know that? Did program finished and nothing is written? Did file existed before? What about bin file? What about permissions? Is there anything preventing your program from creating this file?
I first created txt file then renamed it to dat, then wrote to it, but didnt work but when changed to bin it worked
Topic archived. No new replies allowed.