Rewinding stdout not working..

Started by
8 comments, last by n0ob 19 years, 6 months ago
I'm trying to write a buffer to stdout, go back to the start, and write another one. I guess this isn't possible? I've tried rewind, fseek(stdou, 0, SEEK_SET), and a couple other things. I just can't get anything to work here :| Any ideas? Thanks!
Advertisement
You can;t rewind stdout, only stdin. Why would you want to rewind stdout?
I'm pretty sure you can't, and why would you want to?
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
What if i wanted to write a few strings, then write something else over the top of them??
you might like the "\r" special character, which is just a carriage return (instead of newline + carriage return.)

i dunno.
That won't let me jump up though will it
system("cls") gives .. acceptable results.. but.. really, there should be a file-based alternative or whatever..
There's no standard way to do that. There's the non-standard conio library, Microsofts uber scary console API, ansi escape codes, and in *nix you have ncurses.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
You can use the Win32 console functions to set the cursor position back to (0,0). But as far as I'm aware, theres no way to do it with standard C. What if the console output is a printer (which it might be on some embedded systems)? You can't feed the paper back in and write over it again.
If I engineer'd a printer, you would be able to. Anyway, I know about conio and the writeconsoleoutput stuff, but I'm trying to do this with the standard crud or whatever. Thanks for all your help!

This topic is closed to new replies.

Advertisement