I keep getting errors like the one I included.
These error usually accure when the client is disconnected from the server and the function StartRecieve ends (due to connection lost).
Can someone help me fix it ? :\
I also included the source code.
I keep getting errors like the one I included.
These error usually accure when the client is disconnected from the server and the function StartRecieve ends (due to connection lost).
Can someone help me fix it ? :\
I also included the source code.
I think the problem might be in using CString::Format or CString::GetBuffer too many times.
Might that be?
I can actually see a problem in your code:
checkout in your ReadLine function, you're using LastChar without having any data there, it's actually undefined.
try something like:
LastChar = ' ';
and then the rest of your code.
I corrected it but that doesn't fix it.
The error happends when StartRecieve and StartCom ends (2 times)
1. It's impossible to tell from only a snippet of utility functions how exactly you're using (or abusing) the code.
2. This is at best unwise
strcat(strText, "\r\n");
ar.Write(strText, strlen(strText));
Who said that your string was a) modifiable, and b) with enough reserve space to add characters to the end and c) does the caller know you do this?
Try
ar.Write(strText, strlen(strText));
ar.Write("\r\n", 2);
And make your string parameter const.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
Thanks alot man, that solved the problem.
And the code I posted here is the code I wrote, I used SDI from the MFC Application menu, so i figured there's no point in posting that.