Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strtok linker problem

Status
Not open for further replies.

chigley

Programmer
Sep 30, 2002
104
0
0
GB
I am writing a kernel mode driver for Windows Vista. I want to use the strtok function. When I compile I get

LKN2019: unresolved external symbol __imp__strtok

Is strtok compatible with this version of the DDK?
I am using latest DDK. I have included string.h, and it compiles but won't link. Any ideas??

I am not aversed to writing a custom strtok function, and if anyone has a good example for me to follow that would also be a good solution.

I am string to take a string

10,20,30,40,50

and convert it to and array of ints, by parsing the string.

Thanks

Charlie Benger-Stevenson
Hart Hill IT Ltd
 
For positive integers and zeroes only, no overflow check:
Code:
int CvtIntList(int* iarr, int maxn, const char* plist)
{
    int x, n = 0;
    char ch;
    if (!plist)
        return 0;
    if (!iarr)
        maxn = 0;
    do
    {
        while ((ch=*plist++) != '\0' && (ch < '0' || ch >= '9'))
            ;
        if (ch == '\0')
            break;
        x = ch - '0';
        while ((ch=*plist++) >= '0' && ch <= '9')
        {
            x *= 10;
            x += ch - '0';
        }
        if (n < maxn)
            iarr[n] = x;
        ++n;
    } while (ch);
    return n;
}
 
Can you read the original post? Strtok gives me an error in kernel mode. That is why I am either looking for an answer to while the code will not link, or an alternative method for parsing the values into an array of ints.

Charlie Benger-Stevenson
Hart Hill IT Ltd
 
What's a surprise! You have the answer but start a new thread on this topic...
 
I do not have the answer. The above code does not work, nor does it do what I need and everyone seemed to be ignoring the point that strtok does not work for me, so posts such as "try strtok" lead me to think that maybe the one post with two distinct trains for thought may be too much for some people. So I started another thread JUST to deal with the strtok replacement problem, thereby leaving this thread open for the original compiler/linker problem.

Really if you don't have anything constructive to post, then please do not bother.



Charlie Benger-Stevenson
Hart Hill IT Ltd
 
I am string to take a string
10,20,30,40,50
and convert it to and array of ints, by parsing the string.
CvtIntList works OK and parse such (and others) strings.
I do not have the answer. The above code does not work, nor does it do what I need...
Can you present an example?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top