title: How to increase number of serial data assigned to variable?
body: <p>I have downloaded and installed the comport library. I have a simulator sending data through serial RS232 to a Selphi program. This is the following code snippet. </p>
  
  <pre><code>procedure TMainForm.ComPortRxChar(Sender: TObject; Count: Integer);
  begin
    ComPort.ReadStr(CPort.Str, Count);
    Memo.Text := Memo.Text + CPort.Str;
  end; 
  </code></pre>
  
  <p>As for the CPort library portion, I added:</p>
  
  <pre><code>var
    Str: String;
  
  here is the problem.
  </code></pre>
  
  <p>The data example that is coming through is roughly like</p>
  
  <pre><code>$HEHDT,288.45,T*1D
  $HEHDT,288.46,T*18
  $HEHDT,288.47,T*1A
  </code></pre>
  
  <p>and so on. Each line is sent per second. So with the code above, the memo will display all these data as it. </p>
  
  <p>However, if I change the code to: </p>
  
  <pre><code>procedure TMainForm.ComPortRxChar(Sender: TObject; Count: Integer);
  begin
    ComPort.ReadStr(CPort.Str, Count);
    Memo.Text := Memo.Text + CPort.Str + 'haha';
  end;
  </code></pre>
  
  <p>This is what appears on the memo:</p>
  
  <pre><code>$HEHDT,2haha88.45,T*haha1Dhaha
  $HEHDT,2haha88.46,T*haha18haha
  $HEHDT,2haha88.47,T*haha1Ahaha
  </code></pre>
  
  <p>The "haha" appears after 8 ASCII characters. so does that mean in the CPort.pas
  library, under the asynchronous/synchronous portion, only 8ASCII characters max is
  assigned to the variable Str?</p>
  
  <p>How do I go about changing the codes such that the whole data string, regardless of
  its size, will be allocated to the variable Str instead of only 8 bytes.</p>
  
  <p>UPDATE**I realised that theres this part of the CPort library that contains the following code. can anyone enlighten me on how to edit the code? or whether it is the correct block that i have sourced out. thanks!</p>
  
  <pre><code>// split buffer in packets
  procedure TComDataPacket.HandleBuffer;
  
  procedure DiscardPacketToPos(Pos: Integer);
  var
  Str: string;
  begin
  FInPacket := True;
  if Pos &gt; 1 then
  begin
    Str := Copy(Buffer, 1, Pos - 1); // some discarded data
    Buffer := Copy(Buffer, Pos, Length(Buffer) - Pos + 1);
    DoDiscard(Str);
  end;
  end;
  
  procedure FormPacket(CutSize: Integer);
  var
  Str: string;
  begin
  Str := Copy(Buffer, 1, CutSize);
  Buffer := Copy(Buffer, CutSize + 1, Length(Buffer) - CutSize);
  CheckIncludeStrings(Str);
  DoPacket(Str);
  end;
  
  procedure StartPacket;
  var
  Found: Integer;
  begin
  // check for custom start condition
  Found := -1;
  DoCustomStart(Buffer, Found);
  if Found &gt; 0 then
    DiscardPacketToPos(Found);
  if Found = -1 then
  begin
    if Length(FStartString) &gt; 0 then // start string valid
    begin
      Found := Pos(Upper(FStartString), Upper(Buffer));
      if Found &gt; 0 then
        DiscardPacketToPos(Found);
    end
    else
      FInPacket := True;
  end;
  end;
  
  procedure EndPacket;
  var
  Found, CutSize, Len: Integer;
  begin
  // check for custom stop condition
  Found := -1;
  DoCustomStop(Buffer, Found);
  if Found &gt; 0 then
  begin
    // custom stop condition detected
    CutSize := Found;
    FInPacket := False;
  end
  else
    if Found = -1 then
    begin
      Len := Length(Buffer);
      if (FSize &gt; 0) and (Len &gt;= FSize) then
      begin
        // size stop condition detected
        FInPacket := False;
        CutSize := FSize;
      end
      else
      begin
        Len := Length(FStartString);
        Found := Pos(Upper(FStopString),
          Upper(Copy(Buffer, Len + 1, Length(Buffer) - Len)));
        if Found &gt; 0 then
        begin
          // stop string stop condition detected
          CutSize := Found + Length(FStopString) + Len - 1;
          FInPacket := False;
        end;
      end;
    end;
  if not FInPacket then
    FormPacket(CutSize); // create packet
  end;
  </code></pre>