Need help with file handling

Hello, World!
I need help with my data file reading, so currently my data file looks like this:

Apple Inc 1 2018 05 18 2019 05 18 1
Motorola 2 2019 01 01 2019 06 01 2

but i want it to be like this:

Apple Inc$ 1 2018$05$18$2019$05$18$1
Motorola$ 2 2019$01$01$2019$06$01$2

So that every variable would be seperated by $ and i tried to do like reading data like this:

getline (file,classname[n].Name, '$');
file >> classname[n].Num1;
getline (file,classname[n].Variable1, '$');
getline (file,classname[n].Variable2, '$');
getline (file,classname[n].Variable3, '$');
getline (file,classname[n].Variable4, '$');
getline (file,classname[n].Variable5, '$');
getline (file,classname[n].Variable6, '$');
file >> classname[n].Num2;

But when i output data it doesn't seem to work, can you help with that?
But when i output data it doesn't seem to work, can you help with that?

What seems to be the problem?

You do realize that you have more data on each line that you are not trying to retrieve, right?

Also please show a small complete program that illustrates your problem, and don't forget to show what the program is outputting and what you think it should be outputting.

By the way why are you trying to retrieve a bunch of numbers into a bunch of strings?
Thanks, for your reply, i managed to fix my errors, btw i am using strings, because if you input 05 as an int it outputs 5, it just ignores 0
Topic archived. No new replies allowed.