11-01-2018 01:01 AM - edited 11-01-2018 01:07 AM
status = viVPrintf(vi, ":SYST:COMM:GPIB:RTER EOI" + vbCrLf, 0)
status = viSetAttribute(vi, VI_ATTR_TMO_VALUE, 20000)
status = viVPrintf(vi, ":MMEM:MSIS 'C’" + vbCrLf, 0)
status = viVPrintf(vi, ":MMEM:CDIR '\USER\DATA\'" + vbCrLf, 0)
status = viVPrintf(vi, ":MMEM:DATA? 'FILE.WMF'" + vbCrLf, 0)
status = viRead(vi, strRes, 72676, retCount)
FileOpen(1, Application.StartupPath + "\FILE.WMF", OpenMode.Output)
Print(1, strRes)
FileClose(1)
"C:\USER\DATA\FILE.WMF" on the instrument, it should be transmitted to the computer, saved as "\FILE.WMF".The result is only 4096 bytes!!!!!
The file start by #560376淄茪 ??
Solved! Go to Solution.
11-01-2018 03:07 AM
Dim fanal As String
For i = 0 To x + y + 1
fanal = fanal & "0"
Next
status = viRead(vi, fanal, x + y + 2, retCount)
FileOpen(1, Application.StartupPath + "\FILE.WMF", OpenMode.Output) '输出文档
Print(1, fanal)
FileClose(1)
I don't know why viRead must assign an initial value equal to the length of the result.
Now all the data can be read out. But the new problem is that the file can't be opened. Even if I delete the header file starting with "#", it won't work.
11-02-2018 03:08 AM
A better way is to use "StringBuilder" instead of "String"!When you use .NET!