Operating System - HP-UX
1833777 Members
2158 Online
110063 Solutions
New Discussion

Abnormal behaviour of "cout" (iostream)

 
arun kumar v
Occasional Advisor

Abnormal behaviour of "cout" (iostream)

Hello

In a c++ application, using the cout object to output data to the stdout, i have a problem where in variables of type "string" are not printed out. But variables of type "int/float" are printed out on to the stdout.

OS used : HP-UX 11.00
model of teh server : D380 (D-Class HP server)


Thanks
Arun Kumar
2 REPLIES 2
Steven Sim Kok Leong
Honored Contributor

Re: Abnormal behaviour of "cout" (iostream)

Hi,

Are you using the cout statement in a try-catch block?

Exception-handling is turned on by default in aC++. If you had turned it off by compiling your objects with +noeh, then any exception that is thrown in your code can cause permanent local memory variables, memory leaks and run-time errors.

However, this cannot possibly explain why int and float still works.

Btw, what is the version of aC++ you are using? I have HP-searched the patch database with the keywords "cout string" and have not come across any relevant patches with regards to the condition you encountered.

Hope this helps. Regards.

Steven Sim Kok Leong
A. Clay Stephenson
Acclaimed Contributor

Re: Abnormal behaviour of "cout" (iostream)

I have used strings with aC++ for quite a while and have never observed this behavior.
If it ain't broke, I can fix that.