local vars are not guaranteed to be zero, init index like

index = 0;

also,

while (file_str_read(source_handle, data_str) != -1) this loop will work only one time, because after the first loop, you close the files.


3333333333