Hi .Roberto
Thanks for your help,
I'm very new to CVI
Hope some other questions may not bother you:
I can't find fread() ,sscanf() in CVI
and If the ReadFile() can be a solution?
//////////////////////////
ReadFile():
Reads up to count bytes of data from a file or the Standard Input into buffer. Reading starts at the current position of the file pointer. When ReadFile completes, the file pointer points to the next unread character in the file.
/////////////////////////
Since the file pointer points to the next unread character in the file when ReadFile() completes,
So use the statement time after time until the file is finished.
I don't know if it can works 'cause I 'm not familiar with ReadFile()
Here is some of my code ,just test if my idea is feasible
but it doesn't work correctly
////////////////
static char proj_dir[MAX_PATHNAME_LEN];
static char file_name[MAX_PATHNAME_LEN];
static double wave[100];
static int handle;
static int err;
static char temp[50];
static int fileHandle;
static byteRead=100;
...
...
...
if (FileSelectPopup ("", "*.dat", "*.dat", "Name of File to Read",
VAL_OK_BUTTON, 0, 1, 1, 0, file_name) > 0)
{
GetCtrlVal (handle, Examp1_InputType, &fileType);
fileHandle = OpenFile (file_name, VAL_READ_ONLY, VAL_OPEN_AS_IS, VAL_ASCII);
byteRead = ReadFile (fileHandle, temp, 50);
DeleteGraphPlot (handle, Examp1_Graph2, -1, 1);
PlotY (handle, Examp1_Graph2, temp, 50, VAL_DOUBLE,
VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1,VAL_RED);
....
...
temp[50] is the buffer into which I read data
should I allocate for the buffer first?
in the PlotY(), temp is Char[], but is need to be numeric array,how can I make a transform?
Regard
Guan
帖子被GuanXuefei在06-19-2005 09:54 PM时编辑过了