• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [newbie]C code does not Run.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [newbie]C code does not Run.


  • Subject: Re: [newbie]C code does not Run.
  • From: Cameron Hayne <email@hidden>
  • Date: Wed, 09 Oct 2002 11:23:47 -0400

On 9/10/02 10:26 am, "kunikyo" <email@hidden> wrote:

> c = getchar();
> while (c != EOF) {
> putchar(c);
> c = getchar();
> }
> [...]
> Build is OK. But this code does not work. I input a character by
> keyboard but this
> code does not work. Nothing was displayed.

Are you typing Return after each character (or at least once in a while)?
You need to type a Return or else your keyboard input is not sent along to
your program. This is just a fact of life when using the stdio functions
which are buffered. Not something particular to Obj-C or OS X - this is the
way it works on all platforms.
You might find the C FAQ useful (see especially question 19.1):
http://www.eskimo.com/~scs/C-faq/top.html

--
Cameron Hayne (email@hidden)
Hayne of Tintagel
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >[newbie]C code does not Run. (From: kunikyo <email@hidden>)

  • Prev by Date: Re: [newbie]C code does not Run.
  • Next by Date: Re: [newbie]C code does not Run.
  • Previous by thread: Re: [newbie]C code does not Run.
  • Next by thread: Re: [newbie]C code does not Run.
  • Index(es):
    • Date
    • Thread