Jump to content
  • Advertisement

Archived

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

spe

IO problem

This topic is 5275 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

Hi! I''m trying to open a bmp file and read the size of the picture, but somehow it doesn''t work. here is the source : #include "stdafx.h" #include <iostream> #include <fstream> using namespace std; int main(int argc, char* argv[]) { int x,y; ifstream file; file.open("BMP/pic.bmp"); file.seekg(18,ios::beg); file>>x>>y; file.close(); return 0; } the x,y variables aren''t changed at all. Could some one help me with this? Thanks ,spe JSoft@coder.hu

Share this post


Link to post
Share on other sites
Advertisement
Read is for reading an array of chars, but I need to read two ints.

Share this post


Link to post
Share on other sites
I tried but I get an error coz x and y are ints and the read func. takes only a pointer to a char.

JSoft@coder.hu

Share this post


Link to post
Share on other sites
It works now with type casting.
Thanks for the help!

JSoft@coder.hu

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!