So I need to create a char buffer containing 4 lines of text (EN_us) like
first line
line with some number like 5
line 3
empty line
What is correct way of getting such char buffer from user and how to get its length?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Instead of getting a buffer like that, it might be easier to read four lines into separate
strings from the standard input usinggetline(use a loop if you prefer):Then the total data length is the sum of the individual
stringlengths. Alternatively use this method to retrieve the data from the user and then concatenate them into a four-linestringstream.Combined code example: