C-language I/O functions Summary

Source: Internet
Author: User
Tags string to file

1, gets () and puts ()(1) Get (): Gets a string from the system's standard input device, reads all character usages before the newline character (excluding line breaks): char * gets( ); The Get () function accepts a string address as a parameter, the read succeeds returns the address of the read-in string, the read failure returns a null pointer null, (2) puts (): Outputs a string to stdout, and the string output is completed automatically adds a newline usage: int puts(char *string); 2, Fgets () and fputs ()(1) fgets (): Reads a string from the stream usage: char * fgets(char *string, int n, FILE *stream); (2) fputs (): write string to file stream usage: int fputs(Char *string, FILE *stream); 3, Getc () and PUTC ()(1) getc (): reads a character from a file usage: int getc(FILE *stream); (2) PUTC (): Write a character to the file usage: int PUTC(char C, FILE *stream); 4, GetChar () and Putchar ()(1) GetChar (): Get a character from a standard input device usage: int GetChar(void); (2) Putchar (): output one character to standard output usage: extern void Putchar(char c); 5, scanf () and printf ()(1) scanf (): Format input function usage: int scanf(char *format[,argument,...]) ; Returns the number of successful read-in elements; (2) printf (): Formatted output function usage: extern int printf(const char *format,...); Returns the number of output characters 6, fscanf () and fprintf ()(1) fscanf (): Perform formatting input usage from a stream: int fscanf(FILE *stream, char *format[,argument ...]) ; (2) fprintf (): Transfer formatted output to a stream usage: int fprintf(FILE *stream, char *format[, argument,...]);

C-language I/O functions Summary

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.