My own fuction: Access Violation error...
- From: Blue Streak <rdlebreton@xxxxxxxxxxx>
- Date: Mon, 10 Mar 2008 13:13:19 -0700 (PDT)
Hello,
I am trying to implement my own version a split function in VC6 using
a vector and strtok().
vector<char *> Split(char *input, const char *sep)
{ //implementation of VB split function using vectors
vector<char *> v;
char *token;
token = " ";
while (token != NULL)
{
token = strtok(input, sep);
v.push_back(token);
}
return v;
}
The only problem is when I trace it through the first token and I have
a space as the separator (haven't tried another separator, yet) it
crashes and burns (i.e. Access Violation) when it reaches the first
separator / space.
Am I doing something blatantly wrong?
Any suggestions to improve this function?
TIA...
.
- Follow-Ups:
- Re: My own fuction: Access Violation error...
- From: Joseph M . Newcomer
- Re: My own fuction: Access Violation error...
- From: AliR \(VC++ MVP\)
- Re: My own fuction: Access Violation error...
- Prev by Date: Re: Recipies of South INDIA
- Next by Date: Re: My own fuction: Access Violation error...
- Previous by thread: what includes what...? (vc6)
- Next by thread: Re: My own fuction: Access Violation error...
- Index(es):
Relevant Pages
|
Loading