Solved

Split strings that contains multiple null terminated strings..

Posted on 2000-03-27
2
350 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

636 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