|
|
1.1 ! root 1: .TH GETC 3S ! 2: .CT 2 file_io ! 3: .SH NAME ! 4: getc, getchar, fgetc, getw, putc, putchar, fputc, putw \(mi character- or word-at-a-time stream input/output ! 5: .SH SYNOPSIS ! 6: .2C ! 7: .nf ! 8: .B #include <stdio.h> ! 9: .PP ! 10: .B int getc(stream) ! 11: .B FILE *stream; ! 12: .PP ! 13: .B int getchar() ! 14: .PP ! 15: .B int getw(stream) ! 16: .B FILE *stream; ! 17: .PP ! 18: .B int fgetc(stream) ! 19: .B FILE *stream; ! 20: .PP ! 21: .B int putc(c, stream) ! 22: .B char c; ! 23: .B FILE *stream; ! 24: .PP ! 25: .B putchar(c) ! 26: .PP ! 27: .B putw(w, stream) ! 28: .B FILE *stream; ! 29: .PP ! 30: .B fputc(c, stream) ! 31: .B FILE *stream; ! 32: .1C ! 33: .fi ! 34: .SH DESCRIPTION ! 35: .I Getc ! 36: returns the next character from the named input ! 37: .IR stream . ! 38: .PP ! 39: .IR Getchar () ! 40: is identical to ! 41: .IR getc ( stdin ). ! 42: .PP ! 43: .I Getw ! 44: returns the next ! 45: word (32-bit integer on a VAX) from the named input ! 46: .IR stream . ! 47: .I Getw ! 48: assumes no special alignment in the file. ! 49: .PP ! 50: .I Putc ! 51: appends the character ! 52: .I c ! 53: to the named output ! 54: .IR stream . ! 55: It returns the character written. ! 56: .PP ! 57: .IR Putchar ( c ) ! 58: is identical to ! 59: .IR putc ( "c, stdout" ). ! 60: .PP ! 61: .I Putw ! 62: appends word ! 63: (i.e.\& ! 64: .BR int ) ! 65: .I w ! 66: to the output ! 67: .IR stream . ! 68: It returns the word written. ! 69: .I Putw ! 70: neither assumes nor causes special alignment in the file. ! 71: .PP ! 72: .I Fgetc ! 73: and ! 74: .I fputc ! 75: behave like ! 76: .I getc ! 77: and ! 78: .I putc, ! 79: but are genuine functions, not macros; ! 80: they may be used to save object text. ! 81: .PP ! 82: The standard output stream ! 83: .B stdout ! 84: is normally buffered, ! 85: but is flushed whenever ! 86: .IR getc ! 87: causes a buffer to be refilled from ! 88: .BR stdin . ! 89: The standard error stream ! 90: .B stderr ! 91: is normally unbuffered. ! 92: These defaults may be changed by ! 93: .IR setbuf (3). ! 94: When an output stream is unbuffered, information appears on the ! 95: destination file or terminal as soon as written. ! 96: When an output stream is buffered, many characters are saved up and written as a block. ! 97: .I Fflush ! 98: may be used to force the block out early; see ! 99: .IR fopen (3). ! 100: .SH "SEE ALSO" ! 101: .IR fopen (3), ! 102: .IR ungetc (3), ! 103: .IR stdio (3) ! 104: .SH DIAGNOSTICS ! 105: These functions return the integer constant ! 106: .B EOF ! 107: at end of file or error. ! 108: For ! 109: .I getw ! 110: or ! 111: .I putw ! 112: this indication is ambiguous; ! 113: .IR ferror (3) ! 114: may be used to distinguish. ! 115: .SH BUGS ! 116: Because they are implemented as macros, ! 117: .I getc ! 118: and ! 119: .I putc ! 120: treat ! 121: .I stream ! 122: arguments with side effects incorrectly. ! 123: For example, ! 124: .B getc(*f++) ! 125: is wrong. ! 126: .br ! 127: The routines in ! 128: .IR printf (3) ! 129: provide temporary buffering ! 130: even when buffering has been turned off. ! 131: .br ! 132: Write errors may be delayed until a subsequent ! 133: .I stdio (3) ! 134: writing, seeking, or file-closing call.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.