I used the following code to copy/edit data between files.
It reads the correct number of records, but onlr seems to get data from 1 record.
Can anyone spot why please.
function names_write_new_level()
{
file_close(namef_handle);
wait(10);
file_close(namew1_handle);
wait(10);
namew1_handle = file_open_read(studnamesw1_str);
testf_handle = file_open_write(testf_str);
wait(10);
file_str_read(namew1_handle,rec_i_txt.string);
wait(5);
rec_cnt = 1;
while(rec_cnt <= total_f_recs)
{
str_cpy(debug01_txt.string,rec_i_txt.string);
wait(1);
beep();
while(key_any == 0)
{
wait(1);
}
str_cpy(rec_o_str,rec_i_txt.string);
str_trunc(rec_i_txt.string,19);
wait(1);
if(str_cmpi(rec_i_txt.string,p_name_txt.string) == 1)
{
// name
str_cpy(rec_w_name_str,newname.string);
//date see rec prep
// add
p_lvl_add = 0;
// sub
p_lvl_sub = 0;
// mul
p_lvl_mul = 0;
// div
p_lvl_div = 0;
wait(1);
waitprec_sw = on;
wait(1);
names_prep_rec();
while(waitprec_sw == on)
{
wait(1);
}
}
else
{
str_cat(rec_o_str,"\n");
}
file_str_write(testf_handle,rec_o_str);
wait(5);
file_str_read(namew1_handle,rec_i_txt.string);
rec_cnt += 1;
wait(5);
}
file_close(testf_handle);
wait(10);
file_close(namew1_handle);
wait(10);
waitwn_sw = off;
}
Last edited by kiamonster; 06/23/09 22:44.