Click here to Skip to main content
14,177,047 members
Rate this:
 
Please Sign up or sign in to vote.
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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

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.
   
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.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

Have a look at this: Reading and Writing CSV Files in MFC[^]
   

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web03 | 2.8.190526.1 | Last Updated 20 Oct 2015
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100