User Tools

Site Tools


el:readbyte

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

el:readbyte [2016/01/01 22:39]
el:readbyte [2020/02/28 10:46] (current)
Line 1: Line 1:
 +===== ReadByte =====
 +==== Σύνταξη ====
 +**readbyte**\\
 +**readbyte**()\\
 +**readbyte**(//ΑριθμόςΑρχείου//)
 +==== Περιγραφή ====
 +Επιστρέφει το επόμενο byte (8 δυαδικά ψηφία) ως έναν ακέραιο 0-255 από ένα ανοιχτό αρχείο. Εάν δεν προσδιορισθεί αριθμός αρχείου τότε θα χρησιμοποιηθεί ο αριθμός μηδέν (0).
 +\\
 +Το αρχείο θα πρέπει να ανοιχθεί με την εντολή [[open|Openb]] ώστε να αποφευχθεί η λανθασμένη αναγνώριση ενός byte ως χαρακτήρα αλλαγής γραμμής.
  
 +==== Παράδειγμα ====
 +
 +<code>
 +cls
 +f$ = "binary.dat"
 +
 +print "neo arxeio"
 +openb f$
 +reset
 +for t = 1 to 20
 +   n = r()
 +   print n+" ";
 +   writebyte n
 +next t
 +print
 +close
 +
 +print "anoigma kai anagnosi"
 +openb f$
 +while not eof
 +   print readbyte()+" ";
 +end while
 +print
 +
 +print "metakinisi stin thesi 10 kai anagnosi"
 +seek 10
 +while not eof
 +   print readbyte()+" ";
 +end while
 +print
 +
 +close
 +
 +end
 +
 +function r()
 +   r = int(rand*256)
 +end function
 +</code>
 +θα απεικονίσει κάτι παρόμοιο με
 +<code>
 +neo arxeio
 +181 163 155 23 46 93 122 212 178 225 1 62 113 130 202 52 185 51 37 165 
 +anoigma kai anagnosi
 +181 163 155 23 46 93 122 212 178 225 1 62 113 130 202 52 185 51 37 165 
 +metakinisi stin thesi 10 kai anagnosi
 +1 62 113 130 202 52 185 51 37 165 
 +</code>
 +
 +
 +
 +==== Δες επίσης ====
 +[[close|Close]], [[eof|Eof]], [[open|Open]], [[open|Openb]], [[readbyte|ReadByte]], [[readline|Readline]], [[reset|Reset]], [[write|Write]], [[writebyte|Writebyte]], [[writeline|Writeline]], [[exists|Exists]], [[seek|Seek]], [[size|Size]]
el/readbyte.txt · Last modified: 2020/02/28 10:46 (external edit)