Solved

Split strings that contains multiple null terminated strings..

Posted on 2000-03-27
2
349 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Suggested Courses

752 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