| 282 | } |
| 283 | |
| 284 | void TFileTest::TestRawPread() { |
| 285 | TTempFile tmp("tmp"); |
| 286 | |
| 287 | { |
| 288 | TFile file(tmp.Name(), OpenAlways | WrOnly); |
| 289 | file.Write("1234567", 7); |
| 290 | file.Flush(); |
| 291 | file.Close(); |
| 292 | } |
| 293 | |
| 294 | { |
| 295 | TFile file(tmp.Name(), OpenExisting | RdOnly); |
| 296 | char buf[7]; |
| 297 | i32 reallyRead = file.RawPread(buf, 3, 1); |
| 298 | Y_ENSURE(0 <= reallyRead && reallyRead <= 3); |
| 299 | Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("234").Head(reallyRead)); |
| 300 | |
| 301 | memset(buf, 0, sizeof(buf)); |
| 302 | reallyRead = file.RawPread(buf, 2, 5); |
| 303 | Y_ENSURE(0 <= reallyRead && reallyRead <= 2); |
| 304 | Y_ENSURE(TStringBuf(buf, reallyRead) == TStringBuf("67").Head(reallyRead)); |
| 305 | } |
| 306 | } |
| 307 | |
| 308 | void TFileTest::TestPread() { |
| 309 | TTempFile tmp("tmp"); |