Help, C++ Newbie

Hi

I have just started to program in C++ at university, the program that i have written runs but i want to use a while loop at the end to ask the user whether they want to run the program again.
If they press 'N' the program shuts down and if they press 'Y' the program does restart but the buffer needs clearing.
The question is how do you clear the buffer?
Please respond ASAP.

Thanks

Rob
[450 byte] By [RMASON123] at [2007-11-20 11:35:05]
# 1 Re: Help, C++ Newbie
Which buffer are you talking about ??
Skizmo at 2007-11-10 22:25:03 >
# 2 Re: Help, C++ Newbie
Hi

I have just started to program in C++ at university, the program that i have written runs but i want to use a while loop at the end to ask the user whether they want to run the program again.
If they press 'N' the program shuts down and if they press 'Y' the program does restart but the buffer needs clearing.
The question is how do you clear the buffer?
Please respond ASAP.

Thanks

Rob
If it's a char array, you can use ZeroMemory or memset (and specify 0, to be used for memset 2nd param).

If it's some C++ object, normally they have some sortof empting mechanism like clear/reset etc etc...

Regards,
Usman.
usman999_1 at 2007-11-10 22:26:03 >
# 3 Re: Help, C++ Newbie
Hi

I have just started to program in C++ at university, the program that i have written runs but i want to use a while loop at the end to ask the user whether they want to run the program again.
If they press 'N' the program shuts down and if they press 'Y' the program does restart but the buffer needs clearing.
The question is how do you clear the buffer?
Please respond ASAP.

Thanks

Rob

what "buffer" do you mean?
If it is the program's text-mode buffer(e.g: the command-line environment), you can use the system function in your program, for example, in Microsoft, system("cls").
alazer at 2007-11-10 22:27:06 >