home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / CH_10 / 570.jpg < prev    next >
Joint Photographic Experts Group Image  |  2014-01-29  |  580KB  |  2550x3300
Labels: book | crt screen | monitor | reckoner
OCR: 570 Chapter 10 Input and #incl ude <ctype h> Note 1 #incl .ude <stdlib h> int main void FILE *fp; int iochar, fopen( "text" NULL pr intf "text cou .an be opened \n" exit( while !feof( fp{ Note Note while isalpha( iochar getc( fp putchar( iochar ; putchar ungetc ochar Note Note while isdigit( iochar getc( fp put tchar( iochar putchar ungetc iochar Note Note while isalpha iochar getc( fp isdigit iochar feof ungetc iochar, Note 8 fclose( return The program consists of the single function ma in() A file named "text" opened, Nested whi loops direct the reading of the contents of "text" After each while loop, the program uses ungetc to set up for the next while loop Note The utilities isdi git and isalpha are defined in I ctype.h. Note 2 The function feof will return zero while there is more inp ...