Jump to content
  • Advertisement

Archived

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

ImmaGNUman

ostream annoyance

This topic is 6487 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 may feel really stupid after this, but here goes: Im outputting an array which is private to the class, using an overloaded ostream << operator. The array is declares: int Tiles[100][100], the data is alright, but it doesn''t like outputting. For example, if I do this inside the overloaded function: for (int i; i < 100; i++) { for (int j = 0; j < 100; j++) { stream << CMap->Tiles[100][100]; } } It simply doesnt output. However if I add an & before CMap, it outputs the addresses of where the actual variables are residing. Now, Im wondering if ostream just doesnt like me, or something else is going on with my code. Any suggestions would be appreciated, but my mind boggles at how such simple code can take a day to debug. ----------------------------- A wise man once said "A person with half a clue is more dangerous than a person with or without one." The Micro$haft BSOD T-Shirt

Share this post


Link to post
Share on other sites
Advertisement
Did you type the code in your post correctly, because if you are doing

stream << CMap->Tiles[100][100];

then you are out of bounds with your array indices! Also you haven''t initialised i to zero!

But I reckon these are typos in your post?

Andy.


Share this post


Link to post
Share on other sites
Yeah, just typos. It really should be CMap->Tiles[j]; and int i = 0;

-----------------------------

A wise man once said "A person with half a clue is more dangerous than a person with or without one."

The Micro$haft BSOD T-Shirt

Edited by - immagnuman on January 15, 2001 11:08:45 AM

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!