PDA

View Full Version : running in terminal produces garbage..



jebsector
April 12th, 2011, 05:25 PM
I'm trying to debug a c++ app i'm working on, but when i just ran it in the terminal it produces a bunch of garbage while its running. i don't know what output it is even producing. it just takes a file and parses it right now.

This is some of what i'm talking about:



�q4 s4Ps4     ��������8s4Ps4�q4
`s4�t4�u4     ���������u4�u4`s4 \s*\'.*\'\s*A�$��`����Px4��������`x4�������� 

dwhitney67
April 12th, 2011, 06:10 PM
You will need to show your source code before anyone can tell you why there is an issue... or if you want, we can play a guessing game.

For now, here's my first guess... you are outputting to standard out the contents of a binary file.

GeneralZod
April 12th, 2011, 06:22 PM
Ooh! Ooh! I guess that you are printing a (C-style) string that is not null-terminated!

jebsector
April 12th, 2011, 06:29 PM
ok apparently all the garbage is coming from the following line:

cout << map->output() << endl;

and in the method output() i forgot to return the string.. :-(