User since
2003-08-04
7321
Artikel
ModeratorIn
perldoc -f ord
ord EXPR
ord Returns the numeric (the native 8-bit encoding, like ASCII or
EBCDIC, or Unicode) value of the first character of EXPR.
QuoteDon't use functions you do not understand!
If you don't understand WHAT are they doing, and how do control what are they doing, simply don't use them. You don't have to know HOW are they doing it, but if you don't feel you understand properly how to use them ... ask someone to help you with the code, let someone review the code, read the documentation ten more times or use something else
--Jenda Krynicky
;)\n\n
<!--EDIT|esskar|1109606148-->
Hallo,
ich habe Probleme einen Hex-String von einer Socketverbindung zu lesen. Ankommen sollte z.B. "01 03 04 a0 ad 41 a4 78 39 "
...
my $buffer = "";
sysread(SOCK, $buffer, 1024, 0);
$buffer = ord($buffer);
print "$buffer \n";
...
so ich krieg aber nur den ersten Abschnitt zurück.
wir bring ich sysread dazu, auch den Rest auszulesen?
hat jemand ne idee?
Danke, Ratz
User since
2003-08-06
2246
Artikel
ModeratorIn
indem Du den sysread() - Aufruf wiederholst, zum Beispiel in einer while-Schleife.
while ( sysread( ... ) ){ print( ord( $buffer ), "\n" ) }