Hi ,

Assuming I have a text file containing numbers , exp : 1_234

And i want to store 1 as int ID1, 234 as ID2.

How can I skip underscore "_" ?

ifstream infile;
infile >> ID1 >> ID2 , ??? I'm still not sure

Thanks .

Recommended Answers

All 3 Replies

Please describe exactly what your file format is -- character by character in general terms (character digit etc...). Write that description down. Look carefully at it. What is your input statement missing given that format.

its just a file .txt , character by character.

I am not sure how to deal with symbols like _ , * when reading from a file.

Reread what I wrote. It tells you to do something specific. Your post shows you did not read it carefully.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.