Jump to content
  • Advertisement


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


fstream io problems with GLUT

This topic is 6010 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 reading pixel data with glReadPixels while using glut, I want to save the array of pixel data in a text format in a file using fstream. fstream will create the file but will not actually write the data to a file from within glutmainloop do you know why? and how to fix it? code: /*the func below is called from glutKeyboardFunc*/ void send_image_data_to_text(void) { RGB value; int x,y; fstream examplefile ("pmg.txt",ios::out); if (examplefile.is_open()) { examplefile << "This is a line2.\n"; examplefile << "This is another line.\n"; examplefile.close(); cout << "ha"; for(x=0; x<70; x++) for(y=0; y<70; y++) { value = pic[0].getPixel(x, y); examplefile << value.r << value.g << value.b; examplefile << "fuck!"; cout << value.r << value.g << value.b; } examplefile.close(); } } this function works fine in a normal VC++ project or in main before glutmainloop is called. This is how I know there is a problem between fstream and glut. If you have any info I would love to here from you.

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!