|
-
June 1st, 2006, 05:54 AM
#1
unhandled exception when using strcpy
I am having problems with the following function:
void ConvertToString(float currentBPM, int trackPos, int nextBeatPos, int beatNum, float* range)
{
ostringstream buffer;
char* ch = "\0";
string st = "";
buffer << setprecision(3) << currentBPM << ends;
st = buffer.str();
strcpy(sendBuffer, st.c_str()); // This line is causing the app to crash!
strcat(sendBuffer, ",");
itoa(trackPos, ch, 10);
strcat(sendBuffer, ch);
strcat(sendBuffer, ",");
itoa(nextBeatPos, ch, 10);
strcat(sendBuffer, ch);
strcat(sendBuffer, ",");
itoa(beatNum, ch, 10);
strcat(sendBuffer, ch);
strcat(sendBuffer, ",");
for(int i=0; i<9; i++)
{
buffer << setprecision(3) << range[i] << ends;
st = buffer.str();
strcat(sendBuffer, st.c_str());
if(i<8)
{
strcat(sendBuffer, ",");
}
}
}
When i run in debug mode in Visual Studio 6, it runs up to the call to strcpy, then asks me to locate strcat.asm.
Am I doing something fundamentally wrong here?
Please help!
Cheers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|