473,382 Members | 1,717 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Problem in Reading string


Hi

I am using VC++.NET, I have a string

c:\folder1;c:\folder2;c:\folder3

I want to sepreate this string into a array of string which should contain

c:\folder1
c:\folder2
c:\folder3

Please Help me.

Amrro
Nov 17 '05 #1
3 1148
CString src = "c:\\folder1;c:\\folder2;c:\\folder3";
int i = 0;
CString token = src.Tokenize(";",i);
while(token != "")
{
cout << (LPCTSTR)token << endl;
token = src.Tokenize(";",i);
}

--
Regards,
Nish [VC++ MVP]
http://www.voidnish.com /* MVP tips tricks and essays web site */
http://blog.voidnish.com /* My blog on C++/CLI, MFC, Whidbey, CLR... */
"Amrro" <pr********@yahoo.com> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...

Hi

I am using VC++.NET, I have a string

c:\folder1;c:\folder2;c:\folder3

I want to sepreate this string into a array of string which should contain

c:\folder1
c:\folder2
c:\folder3

Please Help me.

Amrro

Nov 17 '05 #2
Amrro wrote:
Hi

I am using VC++.NET, I have a string

c:\folder1;c:\folder2;c:\folder3

I want to sepreate this string into a array of string which should contain

c:\folder1
c:\folder2
c:\folder3

Please Help me.

What about copying it character by character until you encounter ';'?


--
Ioannis Vranos
Nov 17 '05 #3
If you know php (or even if you don't :), implement these two functions for
yourself: explode, implode. You will find them very useful when parsing
strings a lot.

http://www.php.net/manual/en/function.explode.php
http://www.php.net/manual/en/function.implode.php
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
7
by: Thomas Sourmail | last post by:
Hi, I hope I am missing something simple, but.. here is my problem: I need my program to check the last column of a file, as in : a b c d target ref 0 0 0 0 1 a 1 0 0 0 1.5 b 2 0 0 0 2 c
11
by: Abhishek | last post by:
I have a problem transfering files using sockets from pocket pc(.net compact c#) to desktop(not using .net just mfc and sockets 2 API). The socket communication is not a issue and I am able to...
2
by: Sabin Finateanu | last post by:
Hi I'm having problem reading a file from my program and I think it's from a procedure I'm using but I don't see where I'm going wrong. Here is the code: public bool AllowUsage() { ...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
5
by: Scott M. Lyon | last post by:
I've just discovered a bug in some code I wrote a little while ago, and I need you guys' help to fix it. My program imports data from a standard Excel Spreadsheet (just with specific column...
14
by: rurpy | last post by:
Another Python docs problem... I was trying to use imp.find_module(). >>> imp.find_module("mymod", "./subdir") ImportError: No frozen submodule named ./subdir.mymod subdir/mymod.py...
11
by: aljaber | last post by:
hi, i am facing a problem with my program output here is the program /*********************************************\ * CD Database * * ...
6
by: efrenba | last post by:
Hi, I came from delphi world and now I'm doing my first steps in C++. I'm using C++builder because its ide is like delphi although I'm trying to avoid the vcl. I need to insert new features...
10
by: oktayarslan | last post by:
Hi all; I have a problem when inserting an element to a vector. All I want is reading some data from a file and putting them into a vector. But the program is crashing after pushing a data which...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.