jeudi 29 mars 2018

in istringstream how can i get time and symbols? in c++

I'm trying to copy information from my file to my program,
For example: Inside Text File 12 John TRUE 01-11-81 8.10-8.20 7.11
And I am trying to assign in following order
ID(int), Name(string), alive(bool), Birthday(ints), time(Here is problem), arrival time(...)
I am using getline and istringstream iss With istringstream everything is going well untill that time. 8.10-8.20

iss>>time.hour>>time.min is this reading untill white space occures? if so why i cant even assign whole time into a string?

char *time;
iss>>time; //this doesn't copy whole (8.10-8.20) time.

can anyone help me to figure what is the problem here?
Even in BOOL I'm just getting it as char* and comparing the first letter, Is there any way to directly, my code recognise it as TRUE or FALSE?

Aucun commentaire:

Enregistrer un commentaire