Thread: Errors i'm having trouble fixing :\

  1. #1
    Registered User
    Join Date
    Dec 2002

    Errors i'm having trouble fixing :\

    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.

  2. #2
    Registered User
    Join Date
    Dec 2002

    I guess no one knows =\

    I think the problem might be in using CString::Format or CString::GetBuffer too many times.
    Might that be?

  3. #3
    Registered User Vber's Avatar
    Join Date
    Nov 2002


    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.

  4. #4
    Registered User
    Join Date
    Dec 2002

    That is a mistake

    I corrected it but that doesn't fix it.
    The error happends when StartRecieve and StartCom ends (2 times)

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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?

    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.

  6. #6
    Registered User
    Join Date
    Dec 2002


    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. global namespace errors
    By stubaan in forum C++ Programming
    Replies: 9
    Last Post: 04-02-2008, 03:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 10:50 AM
  3. Header File Errors...
    By Junior89 in forum C++ Programming
    Replies: 5
    Last Post: 07-08-2007, 12:28 AM
  4. Replies: 6
    Last Post: 01-03-2007, 03:02 PM
  5. Sneaky little linker errors...
    By Tozar in forum C++ Programming
    Replies: 8
    Last Post: 10-25-2006, 05:40 AM