Reading white spaces of a c-string from fstream

Hi guys,
I am not sure how to include white spaces in my output. For example, this is the file it should read from.

1
2
3
4
5
6
7
8
9
10
11
12
13
3
1001
McDonald Figure
100
10.90
1002
Dog Calendar
50
15.00
1003
Hotwheels Toy Car
1000
8.90


However, using the code I produced, I get the following output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Enter file name here: toys


~WELCOME TO NEW HAMPSHIRE TOY STORE!~
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
1. View all toys.
2. Add a new toy data.
3. PURCHASE A TOY!
4. Display overall total of all purchases.
5. Update a toy's information.
6. Exit...

I pick option: 1


Toy ID: 1001
Toy Description: McDonald
Quantity Available: 0
Price: $0.00

Toy ID: 0
Toy Description:
Quantity Available: 0
Price: $0.00

Toy ID: 0
Toy Description:
Quantity Available: 0
Price: $0.00

~WELCOME TO NEW HAMPSHIRE TOY STORE!~
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
1. View all toys.
2. Add a new toy data.
3. PURCHASE A TOY!
4. Display overall total of all purchases.
5. Update a toy's information.
6. Exit...

I pick option: 6

Process returned 0 (0x0)   execution time : 12.980 s
Press any key to continue.


If I remove the white spaces from the toy description as such:
1
2
3
4
5
6
7
8
9
10
11
12
13
3
1001
McDonald
100
10.90
1002
Dog
50
15.00
1003
Hotwheels
1000
8.90


I will be able to obtain the right output but without it's full description.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Enter file name here: toys


~WELCOME TO NEW HAMPSHIRE TOY STORE!~
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
1. View all toys.
2. Add a new toy data.
3. PURCHASE A TOY!
4. Display overall total of all purchases.
5. Update a toy's information.
6. Exit...

I pick option: 1


Toy ID: 1001
Toy Description: McDonald
Quantity Available: 100
Price: $10.90

Toy ID: 1002
Toy Description: Dog
Quantity Available: 50
Price: $15.00

Toy ID: 1003
Toy Description: Hotwheels
Quantity Available: 1000
Price: $8.90

~WELCOME TO NEW HAMPSHIRE TOY STORE!~
~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
1. View all toys.
2. Add a new toy data.
3. PURCHASE A TOY!
4. Display overall total of all purchases.
5. Update a toy's information.
6. Exit...

I pick option: 6

Process returned 0 (0x0)   execution time : 5.884 s
Press any key to continue.


Can someone please teach me how do I solve this issue? I cannot use strings, only c-string is allowed.
Use inFile.getline() to read the toy name.

For example :
1
2
3
4
inFile >> toyID; inFile.ignore(); // This line is needed

char toyName[100];
inFile.getline(toyName, sizeof(toyName));
WOW THANKS! IT WORKS PERFECTLY :)
Topic archived. No new replies allowed.