can you please explain in detail what the followinf code does?
especially what does the fgets,sizeof,and sscanf do?
char buf[50];
int option;
fgets (buf, sizeof(buf), stdin);
sscanf (buf, "%i", %26amp;option);
Some c++ coding doubts(string stream)?
fgets-: reads a string from a file
sscanf-:reads formatted input from a string
sizeof :- u have to enter the no of bits u want too use
Reply:stdin is a buffer between either the terminal or the DOS prompt. fgets is just getting what ever is in the then sscanf is putting it in option. Its a round and about way of asking for user input
forsythia
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment