07-13-2011 01:47 AM
Hi All
I want to read a 10Mb file in CVI, but 10 words in one attempt. How it will posible to set file pointer in next location ? I also used
SetFilePtr (FileHandler1, 11, 1); but there is no effect on the output...
FileHandler1 = OpenFile ("TestFile.txt", VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
FileToArray ("Bc2Rt.txt", ReadData1, VAL_UNSIGNED_SHORT_INTEGER, 10, 1, VAL_DATA_MULTIPLEXED, VAL_GROUPS_AS_COLUMNS, VAL_ASCII);
FileToArray ("Bc2Rt.txt", ReadData2, VAL_UNSIGNED_SHORT_INTEGER, 10, 1, VAL_DATA_MULTIPLEXED, VAL_GROUPS_AS_COLUMNS, VAL_ASCII);
for(count=1;count<=10;count++)
{
SetTableCellVal (panelHandle, PANEL_TABLE1,MakePoint(1, count), ReadData1[count-1]);
SetTableCellVal (panelHandle, PANEL_TABLE2,MakePoint(1, count), ReadData2[count-1]);
}
There is any example code or anyone help me
Regards
Umer
07-13-2011 02:03 AM
Yes, there is an example on the function FileToArray in fileio\arrayfile.cws
07-13-2011 03:36 AM - edited 07-13-2011 03:38 AM
Unfortunately FileToArray does not permit you to skip some values before reading: it reads a specified number of samples but always starting at the beginning of file.
Using SetFilePtr is of no help, since FileToArray opens, reads and closes the file by itself as specifiend in the online help.
To obtain the behaviour you want you must use the file I/O functions OpenFile, SetFilePtr, ReadFile/ReadLine, CloseFile (or fopen, fseek, fread, fclose if you prefere to use native ANSI C functions)