creating a "information processing" feel

This is a discussion on creating a "information processing" feel within the C++ Programming forums, part of the General Programming Boards category; How can I best explain this... I'm am trying to code a prinout that will display periods "..." in succession ...

  1. #1
    Registered User
    Join Date
    Aug 2002
    Posts
    16

    creating a "information processing" feel

    How can I best explain this... I'm am trying to code a prinout that will display periods "..." in succession in order to create a "information processing" type feel. I tried using the command: system("pause"), but it asks for a keypress to continue and that's not what I was going for. Does anyone have any suggestions as to how I can create this effect? I hope you understand what I am asking. =)

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    sleep(1000);

    (might be sleep(1), don't remeber if its secs or millisecs)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  3. #3
    Registered User
    Join Date
    Aug 2002
    Posts
    16
    Must be a different command in Microsoft Visual C++. I tried it and the compiler couldn't recognize the sleep command.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I believe it's located in dos.h
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Registered User
    Join Date
    Aug 2002
    Posts
    16
    Still no. I added #include<dos.h> to my program and the compiler still didn't like the sleep command.

  6. #6
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    VC doesnt have Dos.h. You'll be looking for Sleep() I believe (Note the capital).

    Also, if you're actually processing something then sleep isnt what you're looking for. You just want to add a new '.' to the line as things get done. Could be wrong here.

    printf("Processing");
    DoSomething(stuff);
    printf(".");DoSomethingElse(morestuff);
    printf(".");
    DoSomethingMore(andstuffandstuff);
    printf(".");

    printf(" Done\n");

    If you're just after a delay in the app where dots get displayed, then Sleep() is what you're after.
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  7. #7
    Registered User
    Join Date
    Aug 2002
    Posts
    16
    Perhaps I am missing something, but Sleep() doesn't work either. Here's what I got, but the compiler still complains.

    Code:
    bool Id::verify(int, int){
    	
    	                if(id % 2 == 0 && pin % 2 == 0){
    		student s;
    		Menu start;
    		Sleep(1);
    		cout << ".......";
    		Sleep(1);
    		cout << "...";
    		start.printMenu();
    		return true;
    	}
    Last edited by Rizage; 09-02-2002 at 01:58 AM.

  8. #8
    Peace
    Join Date
    Aug 2001
    Posts
    1,510
    The Sleep function suspends the execution of the current thread for a specified interval.

    VOID Sleep(
    DWORD dwMilliseconds // sleep time in milliseconds
    );

    Milliseconds. 1 millisecond is not very long. Compiler shouldnt be complaining. I'm assuming you included windows.h ... ? What error?

    Plus, instead of this:

    Sleep(1);
    cout << ".......";
    Sleep(1);
    cout << "...";

    try:

    for(int i = 0; i < 10; i ++)
    {
    Sleep(200);
    cout << ".";
    }
    "There's always another way"
    -lightatdawn (lightatdawn.cprogramming.com)

  9. #9
    Registered User
    Join Date
    Aug 2002
    Posts
    16
    Thanks all, I got it working.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Help creating multiple text files
    By Tom Bombadil in forum C Programming
    Replies: 19
    Last Post: 03-28-2009, 11:21 AM
  2. Profiler Valgrind
    By afflictedd2 in forum C++ Programming
    Replies: 4
    Last Post: 07-18-2008, 09:38 AM
  3. Help creating lists of pointers
    By The_Kingpin in forum C Programming
    Replies: 2
    Last Post: 12-11-2004, 07:10 PM
  4. Creating Custom Controls
    By Grayson_Peddie in forum C# Programming
    Replies: 1
    Last Post: 12-29-2003, 12:41 PM
  5. Creating an Code-template in Visual C++
    By yerrel in forum C++ Programming
    Replies: 1
    Last Post: 06-10-2002, 11:25 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21