Solved

Split strings that contains multiple null terminated strings..

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
repeatEnd java challenge 42 83
repeatSeparator  java  challenge 13 56
sum67 challenge 35 89
Window placement 17 65
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Database storage, where is the exe actually on the disc? Playing a game selected randomly (how to generate random numbers).  Error trapping with try..catch to help the code run even if something goes wrong. Continuing from the seve…
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 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

10 Experts available now in Live!

Get 1:1 Help Now