I have to take three inputs in a single string.
The code to take the input is:
char msg_send[1000];
gets(msg_send);
The input is like
GET /api HTTP/1.1
id=1&name=phoenix&mail=bringchills@ppks.com
That means there is a newline after the fist line GET /api HTTP/1.1
. The next line is an empty newline. The input taking function should terminate after taking the 3rd newline.
Also, I have to terminate the input after the first line GET /something HTTP/1.1
if the line doesn't have a /api
word at the place of /something
word.
But when I'm using gets(), it terminates the string after taking GET /api HTTP/1.1
part of the input. When using scanf, it terminates after taking only the first GET
word. Is there any way to take the input as a single string?