Everything is in the title. I barely can paste code here since the project is big. It has happened after some modifications in my code but I cannot figure out what changes could lead to that.
Does anyone know some reason cout can break like that ?
In my case, nothing more is printed ! Is there a mean I could have broken cout at some point ? Though I really cannot figure out what on the heal I could have done bad. cout is simple, isn't it ?
What do you mean "cout is simple"? Simple in what way?
Here's a more important question: how do you know the program keeps going but just doesn't output? Is there some other indication that it has progressed past the point where it stopped printing?
What do you mean "cout is simple"? Simple in what way?
I mean in term of usage.
The program otherwise ends correctly since :
1) I have several output files which are correctly filled.
2) It is a console only application and no exception is displayed.
3) I receive the prompt back normally.
I have just checked all my cout. I have either of these two forms :
cout, cerr, and clog are all usually mapped to the same output stream on Windows. Exceptions would end your program, not get displayed. (they might get a fancy error dialog if you run in debug mode, or a crash report dialog)
I run my application from the command line in a shell (under Linux). When the program exits, the prompt ($) is back and the command line is available for new commands.
You might have gotten an error. Why don't you just post your code? If table t only has 9 elements, then your program should terminate because of out of bounds. Though I doubt this is the case. Just post all of your code and someone should be able to help you from the git go rather than just guess around.
No, this was just a simplified example of my cout use cases.
Why don't you just post your code?
thousands of lines ?
Besides, I am not authorised to post this code. I must isolate the problem, suppress sensitive information, and so on. For most problems, it is easy, but here, it is not. But I agree it is the only reasonable way. So I will do it. But it will takes me some time.
You have thousands of lines of code, and yet your problem is something as simple as this? I don't believe you, to be honest. But, if each of your lines has a format EXACTLY like the ones you showed, then you have no problem.
(Which means somewhere in your code, there is a line with a format that isn't like the ones you gave us. And to be honest, if you are using an ide, it should tell you exactly approximately (if its a syntax error) which line is causing the problem.)
Edit: My mistake about that. I forgot that everyone else is using outdated IDEs. If only I could give everyone my Magical one.
OH Lol, I didn't read that last line. If you can't post the code, then DON'T do it.
Also. To give another quick answer like the ones above, if any of your lines have '\0' a null character, then that would stop the output also, in most cases.
If you spam COUT, the command line window might just give up on you and lag. I know this happens in Konsole (KDE4, OpenSuse) when I accidentally COUT in an infinite loop.
Which means somewhere in your code, there is a line with a format that isn't like the ones you gave us. And to be honest, if you are using an ide, it should tell you exactly which line is causing the problem.)
I have NO error message at all. Simply, cout first works and somewhere stops working.
if any of your lines have '\0' a null character, then that would stop the output also, in most cases
Thanks for the tip Vlykarye. This is a good idea to look for.
If you spam COUT, the command line window might just give up on you and lag. I know this happens in Konsole (KDE4, OpenSuse) when I accidentally COUT in an infinite loop.
Have you bothered checking the state of cout since you've had problems? Does your program continue to run or do you assume it does and that output is the problem?
My guess would be that you've trashed some memory at some point, and your cout problems are the manifestation of that.
Ok. I looked through it. I suggest that you redo all of this code. Why is down below.
If only 100 lines is output, then what do the other 900 lines do? Would be helpful since the output lines are using functions and variables in the rest of the 900 lines.
Anyways. The code looks poorly written and hard to read. It would probably suit you and whoever you are working for to rewrite it.
Why? Because it would seem like you are having a problem finding out where the error is (whether it be syntactical or logical). I'm not a genie, but I would guess that you'd have an easier time finding any errors if you're output statements were separated into multiple statements. Which is what I meant by this.
Edit: Thought I would offer some explanation which I thought was obvious.