"Incompatible access to a file" on FileWriteDouble

 

Hi,


When I run the following code I get the output "OK = incompatible access to a file, bytes = -1". Can anyone see why? The file is being created ok, it just won't write any values (or read, if i put the values in manually).

Thanks

   int handle = FileOpen("file.csv", FILE_CSV | FILE_WRITE, ';');
   if(handle > 0)
   {
      double d = 1.5555;
      int bytes = FileWriteDouble(handle, d);
      int error=GetLastError();
      MessageBox("OK = " + ErrorDescription(error) + ", bytes " + bytes);
      FileClose(handle);
   }
 
int handle = FileOpen("file.csv", FILE_CSV | FILE_WRITE, ';');
   if(handle > 0)
   {
      double d = 1.5555;
      FileWrite(handle, d);
      int error=GetLastError();
      MessageBox("OK = " + ErrorDescription(error));
      FileClose(handle);
   }
 
awesome thanks that works... so i guess FileWriteDouble doesn't work
 
FileWriteDouble is meant for use with binary files, you specified CVS type of a file, for which you use FileWrite.
 

one more question - How do I read csv files? There's no FileRead(), and FileReadDouble gives the same 'incompatible access...' error


thanks

 
nm, i can do it through FileReadString, and StrToDouble
Reason: