Can't sleep properly...

This is a discussion on Can't sleep properly... within the C++ Programming forums, part of the General Programming Boards category; I'm a newbie C programmer and am having trouble using sleep(i); whilst trying to write to a single line. Im ...

  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
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    It makes you ask questions

  5. #5
    Intranasal Heroin User Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,035
    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, 08: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, 11:40 AM

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