Unformatted text input and output means either single character input or output or input output of null terminated strings. There are four library function available and they are getchar, putchar, gets and puts.
getchargetchar() - read one single character from console. This function is blocking and waits for return key press. It returns immediately after enter key is pressed. Return value is the ASCII key which is equivalient to the key press.
putcharputchar() - writes a single character to the console. It is a blocking function and waits until character is written to the console file and returns the same value.
getsgets() - reads characters from stdin and returns when new line character is reached. This is a blocking function. It takes a character buffer and populates characters as it reads from stdin. It puts a null character instead of new line when it receives enter key press.
putsputs() - It takes a constant null terminated string and copies the buffer to stdout. It also puts an extra newline character when it reaches end of input string. Output is visible in the console. This function is blocking and returns when all buffer characters are copied to stdout.
-------------------- Enter a string : this is a text1 Log text : this is a text1 Want to repeat (Y/N): Y Enter a string : this is a text2 Log text : this is a text2 Want to repeat (Y/N): N --------------------
About our authors: Team EQA
You have viewed 1 page out of 248. Your C learning is 0.00% complete. Login to check your learning progress.
Questions index C Questions C++ Questions Win32 MFC COM/DCOM DLL Questions
Compilers & Editors
Download Visual Studio Download XCode Download Visual Studio Code Android studio install sdk Eclipse installer Best C compilers IDEs
Development system setup
Windows media creation tool MSDN subscription Ubuntu virtualbox
New updated posts
Why learn C? Calculate weighted average