Tema: readfile?
Ver Mensaje Individual
  #2  
Antiguo 04-03-2008
Avatar de cHackAll
[cHackAll] cHackAll is offline
Baneado?
 
Registrado: oct 2006
Posts: 2.159
Reputación: 20
cHackAll Va por buen camino
El problema es que no se está inicializando la variable de retorno (string); una posible solucion es usar cadenas cortas;

Código Delphi [-]
function Leer_Puerto_Serie2(Count: Byte): ShortString;
var Bytes: Cardinal;
begin
 if not ReadFile(serial_handle, Result[1], Count, Bytes, nil) then
  ShowMessage('Error Read Puerto Serie');
 Result[0] := Bytes;
 if Bytes = 0 then
  Showmessage('No Hay Dato en el Puerto Serie');
end;

Y la otra es inicializar dicha cadena ls_cadena[1], con SetLength.. y una vez leido del puerto corregir su dimensión.

Saludos
Responder Con Cita