Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

WriteStr - ComPort bug or my bug?

2011-09-04
2013-04-30
  • Floyd Bloke
    Floyd Bloke
    2011-09-04

    I’m stuck in the dark ages with BCB6 and trying to use the ComPort library.  I have successfully managed to install the packages into the VCL, and circumvented the documented bugs.

    In my app I can successfully tie the ComPort component to a serial port and open a connection, but when I try to send an exception is thrown, my code contains the following:

    int my_int=0;
    AnsiString my_str;
    

    And a button click event handler with:

    my_str = IntToStr(my_int);
    ComPort1->WriteStr(my_str);
    my_int++;
    

    This runs through fine on the first iteration but crashes the next time around.
    Adding a watch and stepping through my code, I note that this line:

    ComPort1->WriteStr(my_str)
    

    ;
    changes the value of my_str.

    I can’t figure out why it would do this.  Is it a bug in the ComPort library, or sloppy coding on my behalf?  All suggestions welcome.

     
  • Floyd Bloke
    Floyd Bloke
    2011-09-04

    OK doing some further digging, I checked the bug-tracker (apologies, should have done this sooner, I'm very much a part-time hobby-ist programmer trying to find my way around sourceforge) and came across 3300369 .

    Is this somehow related to the problems I'm experiencing.  The bug report  also suggests a workaround but my programming expertise is way too rudimentary for me to convert it into code, so again, any help is appreciated.