PDA

View Full Version : READING TEXT FILES WITH OPENGL



zadeh79
02-25-2007, 07:00 AM
For the game I am making, I need to save game state information to a file (so the user can continue where they left off). Is it possible to use functions such as ifstream with OPENGL? http://us.share.geocities.com/zadeh1979/stones.bmp

Zengar
02-25-2007, 07:15 AM
OpenGL has nothing to do with file input/output, it is a graphics library. You can use any file handling functions as you want. I would still wish for you to hear to mine and not only advice, and redesign your application completely. The way you write your code is a complete mess.

Overmind
02-25-2007, 12:31 PM
http://www.catb.org/~esr/faqs/smart-questions.html

Please really read it this time.

Korval
02-25-2007, 02:07 PM
Since this thread is dead, I would like to go on record with something.

While I appreciate the purpose of that FAQ, I have to say that it is somewhat counterproductive. Why?

Because it makes programmers seem like colossal jerks. I mean, it's one thing to say that your question is bad in some way, but the beginning of that document (for people who aren't programmers) make us all sound like grand, great, flaming jerks.

If I weren't actually a programmer, and I asked a question, and someone directed me to that faq, I'd immediately think, "These people are jerks, and I don't want to waste my time dealing with them." It basically makes the programmer community look bad to anyone who might want help from them.

plasmonster
02-25-2007, 05:25 PM
Agreed, Korval. I think the message is a good one, but the tone of conveyance leaves a lot to be desired (it's reminiscent of SNL's "Nick Burns, your company's computer guy" ... MOV!) :D

Perhaps age is a factor here.

V-man
02-25-2007, 11:23 PM
Yes, that page is a bit harsh. "don't ask stupid questions, we'll ignore you!"

It's best to give some tips

fopen
fwrite
fread
fclose

Just search for those and you will find plenty of info. There are other functions to do file I/O as well, but I prefer these low level ones.

It's called a win-win situation when you help someone and tell them the Q is off topic.

RigidBody
02-25-2007, 11:53 PM
for text files, fgets is probably better than fread (and fprintf better than fwrite).