C scripting file reader fgetc()


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting C scripting file reader fgetc()
# 1  
Old 05-10-2009
C scripting file reader fgetc()

Code:
$ cat test
a b c d e
f g h i j
k l m n

Code:
FILE *p;
p = fopen("a.text","r")
int a;
while ( (a = fgetc(p)) != EOF ) {
   printf ("current character is %c \n",a);
}

the code above only prints the first line of the file
a b c d e

i don't know why it doesn't go through the whole file.
Can someone help me please?
# 2  
Old 05-10-2009
never mind I found one
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Gzip reader

Hi , I have gzip file. Is it possible to script a code which can read from compressed byte offset to uncompressed byte length? Regards, Chetan.C (5 Replies)
Discussion started by: chetan.c
5 Replies

2. Solaris

Serial Barcode Reader

I have a serial barcode reader which I attached to my Solaris 10 workstation. I can see the barcode scanned data appearing when I do a tip hardwire. Question is how can I enable the data to appear in command prompt or any text editor programs? Thanks for the help (3 Replies)
Discussion started by: timtan169
3 Replies

3. Programming

Linux C - how to open a pdf file with default reader

sorry if i repost this... hi.. i want to ask how to open pdf files using C in Linux in Windows, i just use this code: ShellExecute(GetDesktopWindow(), "open", "D:\\Folder\\File.pdf", NULL, NULL, SW_SHOWNORMAL); thanks for advance... (3 Replies)
Discussion started by: sunardo
3 Replies

4. AIX

pdf reader

which package is to be installed to view pdf files in AIX machine? i already have xpdf version 1...but, some pdf files are not opening in it.help me out. (1 Reply)
Discussion started by: me.kamph
1 Replies

5. Programming

.tga file reader + programming language

For a job I have to do, I have to design a .tga file reader, however I have had no prior experience in this area, so I was wondering what would be the best language to use to develop my .tga reader ? many thanks (1 Reply)
Discussion started by: JamesGoh
1 Replies

6. Programming

Document file reader for HPUX

Hi All, has anyone found any document file reader for HPUX? I have been finding myself in trouble without having one.. if there is nothing that exist, I am thinking of developing one of my own through C, Not being a professional C programmer, I need to have a good start.. can someone please throw... (0 Replies)
Discussion started by: sskb
0 Replies

7. UNIX Desktop Questions & Answers

NewsGroup Reader . . . Need Advice

I recently installed Suse 8.0 and am in need of a dependable news group reader. I need something that will authenticate just like Outlook Express does, because I will connecting to an Exchange News Host. Does anyone have any suggestions as to what I should donwload for a Microsoft compatible news... (2 Replies)
Discussion started by: pc9456
2 Replies

8. UNIX for Dummies Questions & Answers

postscript reader for hp-unix

sorry, it is a dumb question, but i could not find any answer in anything else. does anybody know whether there is any postscript file reader for HP-Unix? :) (1 Reply)
Discussion started by: sskb
1 Replies

9. UNIX for Dummies Questions & Answers

Need Wtmp Reader

I would loke to read the WTMP file. This is a binary file in the /var/logs directory. Is there any utility which will convert this binary file to ASCII format? (1 Reply)
Discussion started by: pgold1
1 Replies
Login or Register to Ask a Question