Advertisement

ostream annoyance

Started by January 14, 2001 03:44 PM
1 comment, last by ImmaGNUman 24 years ago
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
-----------------------------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
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.


Advertisement
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
-----------------------------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

This topic is closed to new replies.

Advertisement