RE: A quick c question

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 12 Mar 2008 08:26:40 -0400

Control+d

Take care,
Sina 

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Daniel Dalton
Sent: Wednesday, March 12, 2008 6:59 AM
To: blind programming
Subject: A quick c question

Hi,

I am back learning c.
I need to write a program that prints the value of getchar () when EOF is
received.
So on my system (linux) how do I force the EOF signal to occur when I am
done entering chars?
And how do I print when the EOF is received?
Here is my code.
Any help would be greatly appreciated.

Start code:

#include <stdio.h>

int main (void)
{
      int c;
      c =getchar ();
      while (c !=EOF)
           {
                putchar (c);
                c = getchar ();
                printf("%d\n", c);
           }
      return 0;
}

Thanks,

--
Daniel Dalton

http://members.iinet.net.au/~ddalton/
d.dalton@xxxxxxxxxxxx
__________
View the list's information and change your settings at
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: