Question:

Miracle c and win xp

by  |  earlier

0 LIKES UnLike

I am having this problem. I try to do a basic printf function, but the command prompt will only flash open for a second. So someone on here suggested using System("Pause");

but this just makes the command prompt print repeatedly and then blow up.

http://i29.photobucket.com/albums/c300/Natron3030/miraclec.jpg

Is there a command that will just display one print function? A loop? Thanks!

 Tags:

   Report

1 ANSWERS


  1. EDIT:

    The linker couldn't link in the _kbhit() function? Hmm...

    Well, the compiler didn't complain about anything, so the _kbhit() function is valid in the conio.h header file.

    the _kbhit() function probably resides in another library file.  Currently, the linker is linking your .obj file and the ccl.lib file to form the .exe file, so you probably have to tell the linker to include another .lib file.  I'm not familiar with the Miracle compiler and linker though.  Is there some kind of option in the program or project settings for the linker to include the 'standard libraries' or something like that?  Some IDEs have the option to automatically try linking standard C libraries with every program.

    Oh, these's something else.  Can you display all the program lines?  It's possible that your printf() line is incorrect (causing the crash) and your program is not even reaching any of the code below the printf() line.  (Actually, this might be the root of the problem.)

    ------------------

    #include <conio.h>  /* include this header file */

    while (!_kbhit()) {}  /* put this before your 'return 0;' line */

    EDIT:

    Oh, wait a minute.  Looking at the picture closely, it looks like you forgot to put in the 'return 0;' line!

    You need to specify that line to exit the program.  The '0' can also be another number.  The number specifies the return code to the operating system.  A program which calls your program could get the return code and make use of it.  For example, you could return a '0' if your program completes successfully, and return '-1' if not.

    (Okay, if you have a 'void main() { }' procedure, then you don't REALLY need to have a 'return (number);' line, but it's better form to have it there.)

You're reading: Miracle c and win xp

Question Stats

Latest activity: earlier.
This question has 1 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.