Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


binary output probs..

This topic is 6572 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I can get this code to write correctly to a file, but it will read as 0/0/0. What can i do to stop it ? Ive tried some casting but its gives me a cast error error message about operator not defined. help ! ~V''lion template data_t file::fget(long offset) { data_t value; nfile.seekg(offset, ios::beg);//resets the file pointer to 0 nfile.read((char *) &value, sizeof(data_t) ); return value; } struct DATE { short day; char fil1; short month; char fil2; short year; DATE(short fday=0, short fmonth=0, short fyear=0) { fil1=fil2 = ''/''; day=fday; month=fmonth; year=fyear; } }; int main() { file fio = "test.bin"; DATE ret; DATE valu(1000,2000,3000); fio.write(valu); ret = fio.fget(0); cout << ret.day << '' '' << ret.fil1 << '' '' << ret.month << '' '' << ret.fil2 << '' '' << ret.year; return 0; } I came, I saw, I got programmers block. ~V''lion

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!