×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Strtok linker problem

Strtok linker problem

Strtok linker problem

(OP)
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
www.harthill-it.co.uk
 

RE: Strtok linker problem

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;
}
 

RE: Strtok linker problem

(OP)
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
www.harthill-it.co.uk
 

RE: Strtok linker problem

What's a surprise! You have the answer but start a new thread on this topic...
 

RE: Strtok linker problem

(OP)
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
www.harthill-it.co.uk
 

RE: Strtok linker problem

Quote:


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.

Quote:


I do not have the answer. The above code does not work, nor does it do what I need...
Can you present an example?
 

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close