Jump to content

C LANGUAGE - using input output funtions

- - - - -

  • Please log in to reply
2 replies to this topic

#1
sly

sly

    Newbie

  • Members
  • Pip
  • 3 posts
Good day Guys

I am currently busy with C IO funtions getchar/putchar however ive been unable to execute any program after compiling it,I have to admit im guilty for not blogging this from the begining.

First of all ive compiled:c:\djgpp\bin\student\input output>gcc my_char_input.c -o my_char_input.exe -lm
the resut in CMD:c:\djgpp\bin\student\INPUT~1>

then I will go to rename the source file to my_char_input.exe to create an executable format of the file or was this suppossed to be done by the compiler?

if I proceed and run the file executable file it generates an error for example:c:\djgpp\bin\student\INPUT~1>my_char_input.exe
than it will give an 16 bit MS-DOS Subsystem:C:\windows\system32\cmd.exe - my_char_input.exe The NTVDM CPU has encountered an illegal instruction. Choose close to terminate the Apllication.

please help I really need help learning to execute programs in C.

Thanks in Advance.
Sly

#2
voral

voral

    Learning Programmer

  • Members
  • PipPipPip
  • 30 posts

sly said:

Good day Guys
then I will go to rename the source file to my_char_input.exe to create an executable format of the file
No!!!
You "create" file named as executable file.
Your compiler created executeble file with name "my_char_input.exe"
You ordered to do it yourself:
"gcc my_char_input.c -o my_char_input.exe"

#3
Ancient Dragon

Ancient Dragon

    Programming Expert

  • Members
  • PipPipPipPipPipPip
  • 400 posts
You will need to post the program so that we can see why its causing the problem.
Visit Grandpa's Forums, a social networking forum, with family-oriented arcade games, blogs, discussion forums, and photo albums.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users