![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Carreer:Networking Programming in Unix (C programming Language) | vibhory2j | UNIX for Dummies Questions & Answers | 5 | 09-05-2008 08:57 PM |
| What Makes a Programming Language Successful? | iBot | Complex Event Processing RSS News | 0 | 05-29-2008 06:40 PM |
| The Blue Programming Language 1.5.1 (Default branch) | iBot | Software Releases - RSS News | 0 | 03-21-2008 08:40 PM |
| Qore Programming Language 0.6.2.3 (Default branch) | iBot | Software Releases - RSS News | 0 | 02-11-2008 01:10 AM |
| Does the programming language matters? | HOUSCOUS | UNIX for Dummies Questions & Answers | 8 | 02-21-2002 02:59 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
c programming language
Can someone enligten me on what below program does?
I understand getchar and putchar.. but what is this program suppose to do? I try to put printf on it, but it shows nothing.. can someone explain to me what this program is suppose to do? It is reading something and assigning to c? so, if I do, ./a.out filename , will it assign entire filename's content into c? #include <stdio.h> /* copy input to output; 1st version */ main() { int c; c = getchar(); while (c != EOF) { putchar(c); c = getchar(); } } |
|
||||
|
Quote:
ctrl^D |
|
||||
|
I ran it like that.. and seems to work..
but what are the first character and the number? ni32 <-- example, what is n and 32 for? n[root@rleeserver programming_language_c]# cat > yahoo hi how are you [root@rleeserver programming_language_c]# ./file_copy <yahoo h105 ni32 n 10 n 104 nh111 no119 nw32 n 97 na114 nr101 ne32 n 121 ny111 no117 nu10 n -1 |
|
||||
|
I detected mistake in the source for n
#include <stdio.h> /* copy input to output; 1st version */ main() { int c; c = getchar(); while (c != EOF) { putchar(c); c = getchar(); printf("%d\n", c); } } so, I took it out.. but still put number.... [root@rleeserver programming_language_c]# ./file_copy <yahoo h105 ni32 n 10 n 104 nh111 no119 nw32 n 97 na114 nr101 ne32 n 121 ny111 no117 nu10 n -1 Also, EOF is -1? Is there explanation of EOF anywhere on google?(let me google that too as well now). |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|