Thread: Scrolling Program

  1. #1
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53

    Lightbulb Scrolling Program

    Hey I got alittle program, it scrolls text across the screen. for some reason my compiler (gcc Dev-C++ 4) doesn't recognize the following:

    1) The kbhit() function
    2) the delay() function
    3) it says that my union REGS regs has incomplete type and cannot be intialized. and bails out.

    Please, any suggestions?
    Which 'a Huh?

  2. #2
    & the hat of GPL slaying Thantos's Avatar
    Join Date
    Sep 2001
    Posts
    5,681
    1) The kbhit() function
    2) the delay() function
    These functions are not standard and are compiler specific. GCC doesn't include these functions.

  3. #3
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    Oh, so there isn't a way to write my own function for them? and if I could, do you know of a good place to start.
    Which 'a Huh?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > 1) The kbhit() function
    Use something which is available in win32 which has similar functionality

    > 2) the delay() function
    Use something which is available in win32 which has similar functionality

    > 3) it says that my union REGS regs has incomplete type and cannot be intialized. and bails out.
    REGS is an old data structure used by DOS compilers to call DOS and BIOS interrupts.
    You don't need such low-level things in win32 programs.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    Good, I hate those stupid REG things any way. I uses some old C books that my older brother had when he went to college so thats why i have them. Thanks I'll check those links out.
    Which 'a Huh?

  6. #6
    Registered User Mustang5670's Avatar
    Join Date
    Dec 2003
    Posts
    53
    Ok would I have to use an extra header file with the sleep function. I saw something about a kernel.lib file.

    Code:
    DWORD SleepEx(
      DWORD dwMilliseconds,
      BOOL bAlertable
    );
    if I wanted the program to sleep say, 1000 milliseconds. What would the above code look like?
    Sorry, just new to this stuff.
    Which 'a Huh?

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Stick with

    Sleep( 1000 );

    Simple vanilla wait for a second
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with a program, theres something in it for you
    By engstudent363 in forum C Programming
    Replies: 1
    Last Post: 02-29-2008, 01:41 PM
  2. Replies: 4
    Last Post: 02-21-2008, 10:39 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM