发表于:2004-05-20 10:50:00
1楼
int CVICALLBACK openfile (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
static char file_name[MAX_PATHNAME_LEN];
double *wave ;
long filesize;
if (event == EVENT_COMMIT)
{
status=FileSelectPopup ("d:\\cvi","*.txt","*.txt,*.doc", title, VAL_OK_BUTTON, 0, 0, 1, 0, result) ;
{ GetFileInfo ("file_name", &filesize); /*获取文件的大小*/
wave =malloc(filesize);
FileToArray (file_name, wave, VAL_DOUBLE, filesize/sizeof(double), 1, VAL_GROUPS_TOGETHER, VAL_GROUPS_AS_COLUMNS, VAL_ASCII);
DeleteGraphPlot (mainpanel, MAINPANEL_GRAPH_orig_wave, -1, VAL_IMMEDIATE_DRAW);
PlotY (mainpanel, MAINPANEL_GRAPH_orig_wave, wave,filesize/sizeof(double), VAL_DOUBLE,
VAL_THIN_LINE, VAL_EMPTY_SQUARE, VAL_SOLID, 1, VAL_RED);
}
}
return 0;
}
你看看行不行?