Writing/reading numeric arrays to disc

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Writing/reading numeric arrays to disc

Douglas Benn-2
I would be grateful for some more help.

I am able to write to disc a small array of numbers. However, to use the
split function there needs to be a row delimiter such as ³\n². However,
unless you can mix numeric with string types in an array I cannot see how
you can do this. Here is a section of the code I am using and I get a macro
error ³Index(1) out of 0-0 range    y[i]= parseint(columns[1 <]);²

 file            =File.open(path_img_objs_file);

obj_table[0]=1;obj_table[1]=7;obj_table[2]=99;obj_table[3]=100;//1st row of
array data
obj_table[4]=2;obj_table[5]=21;obj_table[6]=101;obj_table[7]=102;  //2nd row
of array data

  for (i=0;i<8;i++)
      print(file,obj_table[i]);

  File.close(file);
  filestring=    File.openAsString(path_img_objs_file);
  rows=split(filestring, "\n");
  x=newArray(rows.length);
  y=newArray(rows.length);
  for(i=0; i<rows.length; i++)
   {
   columns=split(rows[i]);
   x[i]=parseInt(columns[0]);
   y[i]=parseInt(columns[1]);
   }

Thank you.

Dr Douglas K Benn, BDS, M.Phil., Ph.D., Dipl. Dental Radiology (Royal
College of Radiologists, England).
Professor
Dept of General Dentistry
Creighton University Dental School
2500 California Plaza
Omaha
Nebraska 68178

Tel: (402)280 5025
Fax: (402)280 5094