Advertisement Jump to content

Archived

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

spe

IO problem

This topic is 5338 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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!