Hi, I would like to know what function should I use if I want the user to input a string with the new-line character. fgets terminates reading after a new-line character is found.
This is a discussion on Accept a string with newline within the C Programming forums, part of the General Programming Boards category; Hi, I would like to know what function should I use if I want the user to input a string ...
Hi, I would like to know what function should I use if I want the user to input a string with the new-line character. fgets terminates reading after a new-line character is found.
It depends. For example, you could use fgetc and read until some other character that signals the end of the input, or until a certain number of characters has been read. It may still be feasible to use fgets, depending on how exactly you want to read the input.
C + C++ Compiler: MinGW port of GCC
Version Control System: Bazaar
Look up a C++ Reference and learn How To Ask Questions The Smart Way
Well... you could add it manually.... Take a look at the strcat() function in your docs.