sd card - Issue with file I/O on android -
i met problem recently. need write tmp data file(use api fwrite) in /data/data/com../tmp on android.
the test program run on 1 thread. , write data several hundred kb 1 time.
case 1: in case, create 2 file in path first, , write 2 tmp files turns.
the write process pause few time once in while , sometime few seconds. , if write 1 tmp(but fopen 2 file) file in case, same situation.
case 2: if there 1 tmp file exist in directory. write process never pause..
why write process pause continuously in case 1 ?
thank help.
update:
i have tested several versions of android including 2.3.7 , 4.0.3, 4.1
the code is:
file *tmp1 = fopen(tmp1,"wb"); file *tmp2 = fopen(tmp2,"wb"); file *swap = tmp1; while(..) { if (..) swap = tmp2; else swap = tmp1; fwrite(.., swap) }
Comments
Post a Comment