Patent ID: 7337297

Claim:
A method, applied in an electronic apparatus, for merging a first file and a second file stored in the electronic apparatus, wherein the electronic apparatus comprises a storage medium and a File Allocation Table (FAT) for recording a first start position and a first end position in the storage medium for the first file and recording a second start position and a second end position in the storage medium for the second file, the first file having a header for recording an original file length of the first file, the method comprising: modifying the first end position of the first file to be the second start position of the second file so as to merge the first and second files into a first merged file; calculating a merged file length of the first merged file, wherein the step of calculating the merged file length comprises: obtaining a magnetic region size (S) of the storage medium; respectively obtaining the original file length (N 1 ) of the first file and a second file length (N 2 ) of the second file; calculating M 1 =ceil(N 1 /S) and M 2 =ceil(N 2 /S), where ceil(x) is the least integer greater than or equal to x; and obtaining the merged file length (LEN) to be equal to (M 1 +M 2 )*S; and updating the header with the merged file length so that the merged file length is recorded in the header.