i broke while

Started by
34 comments, last by Tron3k 19 years, 6 months ago
it simply freeses whenever it gets to a while loop.
| Member of UBAAG (Unban aftermath Association of Gamedev)
Advertisement
In which way does it freeze? The example you gave is an infinite loop, so it will never end and therefore appear to be frozen.

Or does it simply not print out any "this" at all?
it simply does not print out anything, it litterly freezes, it does nothing. it just stops.
| Member of UBAAG (Unban aftermath Association of Gamedev)
I've had weird things like that happen to me too when using Visual Studio 6. The common fix seems to be just create a new workspace and file and what not, and just copy and paste your code over to the new files and try it again.

Hope that helps.
-Dan- Can't never could do anything | DansKingdom.com | Dynamic Particle System Framework for XNA
Have you tried it with a \n after the 'this'? It may not be getting a chance to flush the buffer to console.
Why don't you post an example program (run the program, and post it)? If the one you already posted does that, then... wow. But you HAVE to run it first, there may be something else.
Not giving is not stealing.
Does it work on any other projects? If not then reinstall your compiler.

Dont worry you still have for loops and as we all know:

for > while

Some people are langauge nazis, well I am a keyword nazi.
j/k.

______________________________________________________________________________________With the flesh of a cow.
Quote:Original post by Zahlman
Have you tried it with a \n after the 'this'? It may not be getting a chance to flush the buffer to console.


\n doesn't flush the buffer, it just prints a newline, you might be thinking of endl.
'while' isn't broken, it's your printf that isn't outputting anything.
Just use the keyword as you would normally instead of making unrealistic loops that don't flush the output buffer or something.
"In order to understand recursion, you must first understand recursion."
My website dedicated to sorting algorithms
Quote:Original post by Roboguy
Quote:Original post by Zahlman
Have you tried it with a \n after the 'this'? It may not be getting a chance to flush the buffer to console.


\n doesn't flush the buffer, it just prints a newline, you might be thinking of endl.

A newline usually flushes FILE streams.

Interactive streams are eighter line buffered (setvbuf(stream, NULL, _IOLBF, 0)) or completely unbuffered (setvbuf(stream, NULL, _IONBF, 0)), except stderr which is guaranteed to be unbuffered.

All Unix machines I've encountered has been buffered although I suspect that Win32 uses unbuffered mode (or has special handling for the console).

Quote:MSDN
_IOLBF
For some systems, this provides line buffering. However, for Win32, the behavior is the same as _IOFBF - Full Buffering.

This topic is closed to new replies.

Advertisement