CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Help, C++ Newbie

  1. #1
    Join Date
    Oct 2007
    Posts
    3

    Exclamation 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

  2. #2
    Join Date
    Sep 2004
    Location
    Holland (land of the dope)
    Posts
    4,123

    Re: Help, C++ Newbie

    Which buffer are you talking about ??

  3. #3
    Join Date
    Aug 2001
    Location
    Germany
    Posts
    1,384

    Re: Help, C++ Newbie

    Quote Originally Posted by RMASON123
    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.

  4. #4
    Join Date
    Dec 2005
    Posts
    4

    Re: Help, C++ Newbie

    Quote Originally Posted by RMASON123
    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").

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)