- Nov 30, 2007
- 8
- 0
- 0
So I have looked everywhere and cannot find a way to do this. I am using VC++ Express 2005 to develop my code.
I am using the function strtok_s() to break apart a char*, and the return type of strtok_s is a char*.
I have the following code:
>>>string final ;
>>>char tmp1[100] ;
>>>char* tmp2 ;
>>>char* next ;
>>>
>>>tmp2 = strtok_s(tmp1, " ", &next) ;
>>>cout << "tmp2 = " << tmp2 << endl ;
I then want to assign whatever is in tmp2 (the output from the cout function from what I see is what I want) to final, doing this:
final = tmp2 ;
However, when I pass final to one of my functions that takes a string the function breaks. An error box pops up saying:
>>>Debug Assertion Failed!
>>>
>>>Program: ...
>>>File: memcpy_s.c
>>>Line: 55
>>>Espression: dst != NULL
>>>For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
What is going on? And how can I make it so that final (when passed to my function that is basically defined as foo(string x) {} ) will work properly?
Any help is greatly appreciated, thanks a ton!
I am using the function strtok_s() to break apart a char*, and the return type of strtok_s is a char*.
I have the following code:
>>>string final ;
>>>char tmp1[100] ;
>>>char* tmp2 ;
>>>char* next ;
>>>
>>>tmp2 = strtok_s(tmp1, " ", &next) ;
>>>cout << "tmp2 = " << tmp2 << endl ;
I then want to assign whatever is in tmp2 (the output from the cout function from what I see is what I want) to final, doing this:
final = tmp2 ;
However, when I pass final to one of my functions that takes a string the function breaks. An error box pops up saying:
>>>Debug Assertion Failed!
>>>
>>>Program: ...
>>>File: memcpy_s.c
>>>Line: 55
>>>Espression: dst != NULL
>>>For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts.
What is going on? And how can I make it so that final (when passed to my function that is basically defined as foo(string x) {} ) will work properly?
Any help is greatly appreciated, thanks a ton!