Click here to Skip to main content
15,891,657 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Data from .txt file write in array.
I need to read a .txt file in to an array.
exaple of one line in the .txt file:
lastname, prename, town, and so on.
i need to insert every word in another place in the array.

How can i make this?
Thanks a lot
Posted
Comments
Member 12041961 20-Oct-15 3:26am    
ReadLine. But with Readline it just reads the whole line and i have to read
every word alone.

As you are using MFC, you can use CStringT::Tokenize[^] to split every line you read in separate words using the comma (,).
Then you can place each word in the array using a loop.
 
Share this answer
 
Comments
Member 12041961 20-Oct-15 4:22am    
Thanks. Can you make an example with this Tokenize?
George Jonsson 20-Oct-15 6:42am    
You already have one on MSDN. Follow the link.
Just change the code inside the while-loop.
Have a look at this: Reading and Writing CSV Files in MFC[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900