Thread: Can't sleep properly...

  1. #1
    Unregistered
    Guest

    Angry Can't sleep properly...

    I'm a newbie C programmer and am having trouble using sleep(i); whilst trying to write to a single line. Im using said function inside a for loop.
    To write to the same line I use \r.
    Everytime I compile and run the exe, nothing is displayed on the screen until the program has finished executing.

  2. #2
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    what is the '/_' thing do anyway?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  3. #3
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    i mean '\_' thing do anyway?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  4. #4
    It makes you ask questions

  5. #5
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    escape sequences....
    for example
    Code:
    cout << "Hi There!" << endl;
    cout << "I'm on the next line!\n";
    cout << "So am I! wait...but where's the endl?";
    use a backslash '\' for an escape sequence. The Compiler will not print it. in your string say \n somewhere and it will go to the next line. use \t and it will skip 5 spaces(\t means tab). If you want to print a backslash, then type this:
    Code:
    cout << "Bonjour!\\Hello!\n";
    cout << "Je m'eppelle Spongebob.\n\\\nmy name is SpongeBob.";
    That should print:
    Bonjour!\Hello!
    Je m'eppelle Spongebob.
    \\
    My name is SpongeBob.
    Get it?

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    28

    \a

    You can also use it to make a beep eg.
    cout << "Hello, BEEP \a" << endl; \\ or \n
    ...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. [pthread] cancellable sleep in win32?
    By cyberfish in forum C++ Programming
    Replies: 2
    Last Post: 08-11-2007, 02:30 AM
  2. Sleep works with just one thread, but not 2
    By finkus in forum C++ Programming
    Replies: 5
    Last Post: 12-01-2005, 09:17 PM
  3. Problem with Sleep() #$@^#$%^
    By intruder in forum C++ Programming
    Replies: 8
    Last Post: 10-11-2004, 06:46 AM
  4. why do we require sleep?
    By jinx in forum A Brief History of Cprogramming.com
    Replies: 43
    Last Post: 07-14-2004, 08:21 AM
  5. Sleep is overrated...
    By Polymorphic OOP in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 01-24-2003, 12:40 PM