Solved

Split function in vc++

Posted on 2003-11-10
6
310 Views
Last Modified: 2006-11-17
I have text file containing some lines(separated by \r\n) .Each line contains some coma separated values. Is there any built in fns available to spilt a String based on some delimiter and populate it into an array (like split function in vb) in VC++

thanks
gp
0
Comment
Question by:Gopakumar
  • 2
6 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
ID: 9714623
1) strtok function - quick and dirty solution. C++ snobs don't like it, but it works.

2) http://www.boost.org/libs/tokenizer/index.htm - string tokenizer class which is part of Boost library:

http://www.boost.org/
0
 

Expert Comment

by:TheMusikMan
ID: 9722746
strtok is what I usually use, but I believe that strtok is NOT thread safe, so if you're using multi-threading technology, you may have to dig further.

TheMusikMan
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 10319508
I think my answer is OK.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now