Errors i'm having trouble fixing :\

This is a discussion on Errors i'm having trouble fixing :\ within the Windows Programming forums, part of the Platform Specific Boards category; I keep getting errors like the one I included. These error usually accure when the client is disconnected from the ...

  1. #1
    Registered User
    Join Date
    Dec 2002
    Posts
    15

    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.
    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    Dec 2002
    Posts
    15

    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
    Posts
    807

    ...

    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
    Posts
    15

    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
    Location
    The edge of the known universe
    Posts
    32,822
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #6
    Registered User
    Join Date
    Dec 2002
    Posts
    15

    =)

    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, 04:11 PM
  2. Ten Errors
    By AverageSoftware in forum Contests Board
    Replies: 0
    Last Post: 07-20-2007, 11:50 AM
  3. Header File Errors...
    By Junior89 in forum C++ Programming
    Replies: 5
    Last Post: 07-08-2007, 01: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, 06:40 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21