18-8 ������������������������

C@}ɮ׮ɡAMATLAB YO@ɮצmС]File Position Indicator^AHMwU@iŪμgJmCЪƦpUG

\
feof իЬO_bɮ׵m
fseek ]wЦm
ftell oЦm
frewind ]Цɮװ_lm

foef iΩիЬO_bɮ׵mAҦp

Example 1: 18-ɮŪg/feof01.mfid = fopen('test.txt'); A = fscanf(fid, '%g', [3 4]) feof(fid) A = 1 16 49 100 4 25 64 0 9 36 81 0 ans = 1

bWҤAfeof(fid) Ǧ^ 1Aɮ׫Фwgbɮ׵mA] test.txt u]t 10 ӼƥئrCYnbq test.txt _lmŪXơAi frewind ӭ]ЪmG

>> frewind(fid); >> A = fscanf(fid, '%g', 5) A = 1 4 9 16 25

fseek ƥiΩ]wЦmA榡pU

status = fseek(fid, offset, origin)

䤤 fid OɮѧOXAoffset Oq]H byte AiHOƩέtơ^Aorigin NIAi]tUCrG

ftell hiΩǦ^{bЦmCҦp

Example 2: 18-ɮŪg/ftell01.mfid = fopen('test.bin', 'w'); count = fwrite(fid, randperm(10), 'int32'); ftell(fid) ans = 40

40 NФwbɮ׵mCNЦVe 10 bytesAiJpUG

>> fseek(fid, -10, 'cof'); >> ftell(fid) ans = 30

NЪsmO 30C


MATLAB{]pGJg