Solved

Split strings that contains multiple null terminated strings..

Posted on 2000-03-27
2
348 Views
Last Modified: 2013-11-20
When using the GetPrivateProfileSection () I get according to MSDN: "The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character." What's the best way to split the string after the null characters? I want to store each string in a CString. Thanks...
0
Comment
Question by:joakimf
2 Comments
 
LVL 31

Accepted Solution

by:
Zoppo earned 100 total points
ID: 2660426
Hi joakimf,

this functions fills a CStringArray with the strings passed:

void
SplitString( char* t, CStringArray& array )
{
 CString s;
 while ( *t != 0 )
 {
  s = t;
  array.Add( s );
  t += s.GetLength() + 1;
 }
}

hope that helps,

ZOPPO
0
 
LVL 1

Author Comment

by:joakimf
ID: 2664308
Thanks, excellent answer...
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is how to use MFC's automatic Radio Button handling in your dialog boxes and forms.  Beginner programmers usually start with a OnClick handler for each radio button and that's just not the right way to go.  MFC has a very cool system for handli…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

713 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