⚡ fonksiyon
read_bytes
fonksiyon read_bytes
Read a specific number of bytes from the file.
Dosyadan belirli sayıda byte oku.
Parameters / Parametreler
file: The file handle / Dosya handle'ıcount: Number of bytes to read / Okunacak byte sayısı
Returns / Dönüş Değeri
Returns list of bytes read (may be less than count if EOF reached), or error. Okunan byte listesini döner (EOF'a ulaşılırsa count'tan az olabilir), veya hata.
Example / Örnek
değişken f = io.open("image.png", "Read")?
değişken header = io.read_bytes(f, 8)? // Read PNG signature
eğer header[0] == 0x89 ve header[1] == 0x50 yap
yazdır("Valid PNG file")
son
Performance / Performans
O(n) where n=count. Use buf_reader for frequent small reads. O(n) burada n=count. Sık küçük okumalar için buf_reader kullanın.