1. Use fseek
2. Note:
a. In file, byte numbering starts from 0. Therefore, if we want to go to Nth byte, then we have to move the pointer by (N-1) bytes.
fseek(fid, N-1,'bof'); %skips (N-1) bytes and points to Nth byte of the data.
b. In file, byte numbering starts from 0. Therefore, if we want to remove N bytes, move the pointer by N bytes.
fseek(fid, N,'bof'); % skips N bytes and points to N+1 byte of the data.
c. The N has to be an integer.
3. Example:
status = fseek(fid3, floor(numberOfBytesToSkipFromBOFFor20msIntAlignment), 'bof')
ferror(fid3) ; % ferror gives more information if there is any error during fseek operation.
status = 1 means successful operation else there is an error.
2. Note:
a. In file, byte numbering starts from 0. Therefore, if we want to go to Nth byte, then we have to move the pointer by (N-1) bytes.
fseek(fid, N-1,'bof'); %skips (N-1) bytes and points to Nth byte of the data.
b. In file, byte numbering starts from 0. Therefore, if we want to remove N bytes, move the pointer by N bytes.
fseek(fid, N,'bof'); % skips N bytes and points to N+1 byte of the data.
c. The N has to be an integer.
3. Example:
status = fseek(fid3, floor(numberOfBytesToSkipFromBOFFor20msIntAlignment), 'bof')
ferror(fid3) ; % ferror gives more information if there is any error during fseek operation.
status = 1 means successful operation else there is an error.
No comments:
Post a Comment