I asked an interesting (for me) question. Is it possible to read data in C ++ from files in columns, using ifstream? Example: there is a file for many (100k) lines of the following form:
(int float float float соответственно) 1 22.4000 24.1423 24.1352 2 22.2000 24.1441 24.1367 3 22.0000 24.1402 24.1345 etc. In C, reading such a file is elementary:
f = fopen("123.dat","r"); while(!feof(f)) { fscanf(f,"%d %f %f %f",&a,&b,&c,&d); //и обрабатываем a,b,c,d как нам вздумается } But with C ++ there was a question. There were ideas about the use of the separation character, but it is not always clear that there are \ t or spaces. I will be glad to read your comments. Answers in the style of "why not use the C-option and not enjoy life" or "use% name_lib%" library "are not desirable, because it is interesting for me to solve this problem using C ++ and most of sports interest. Thank you in advance for the response
sscanforatof, or maybe even parse the numbers even manually. - nick_n_a