1 - (1)Using with scanf or fscanf: skips leading white...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
(1)Using %s with scanf or fscanf : skips leading white space to first nonwhite space, begins converting stopping with next white space; adds null. Addition of field width sets maximum number of characters to look at, will still stop sooner if encounters white space: %7s will input no more than 7 characters. (2) char * gets(char *string); reads until encounters new line or end of file. Does not store new line; does add terminating null. Returns pointer to string stored. (3) char * fgets(char * string,int n,FILE * ptr); reads no more than n characters from file pointed to by ptr, stops with end of line and DOES store it, also adds null. Returns pointer to string stored. (1)Using % s with printf or fprintf; outputs characters in string up to but not including null. Can use field width to get extra blanks (normally right-justified, use –flag to left-justify); use precision to specify maximum number of characters to output. (2) int puts(const char *string); writes string up to null, then writes new line; returns positive integer if successful. (3)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

1 - (1)Using with scanf or fscanf: skips leading white...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online