Does C++ have access to infile data through a filehandle? For example the typical idiom in Perl is:
while (<DATA>) { chomp; # do sth with $_ } __DATA__ Foo Bar
What’s the way to do that in C++ ?
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.
I wouldn’t say it’s idiomatic as I’ve never seen it in any C++ code, but you can use C++ string stream and C pre-processor string pasting to treat a multi-line string as an input stream: