LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

error using datasocket to get serveral column of ascii data in a text file from ftp server

hi everyone
now i am doing a project about remotely monitoring the water level of a river .
the data recorded in a text file with the name of the data when recording,
like  20060412.txt
data in the file like :
12:36:48    152.42
12:37:47    152.44
12:38:48    152.39
...
I use datasocket functions to get the data  from a ftp server,and show it in a remote computer, with  strip chart
 
 
code about get data is nearly the same as "reader.c" located in cvi/samples/datasocket/
 
the massage showing that :
Connecting: Connecting to URL.
Idle: Download complete.
then it occured an error
saying that:
fuction DS_GetDataValue:(return value == -2147352571 [0x80020005])
it seemed that the my file type does not fit ds fuction
 
how should i deal with it ? any suggestions ?
should  i change the file type for saving the data?
wait for your reply!
thank you !
0 Kudos
Message 1 of 3
(3,095 Views)
This error states that there is incompatibility between type of data in the file and the type of data expected by the function (use DS_GetLibraryErrorString function to obtain a text explaining the error).
The time recorded at the beginning of every line can make the read function fail: you could try reading the file into a string and parsing the string with a customized Scan function to decode data.

Message Edited by Roberto Bozzolo on 04-12-2006 08:43 AM



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 3
(3,084 Views)

I am sorry, r0c, I didnt' read correctly your message!

You are actually reading an unformatted string from the file by the use of the postfix [text] in the url. I made some tests and I got this error when reading in a type different from CAVT_CSTRING (for example reading in a variable of type CAVT_FLOAT). Seems that you must check the variable you are reading the file in.

I found this example supplied from NI: Transferring an ASCII Text File Using DataSocket: it is quite similar to standard DS reader but customized for text files, maybe you can be useful for your needs.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 3
(3,075 Views)