beautypg.com

3 itrace::save – Teledyne LeCroy SierraFC Automation API User Manual

Page 25

background image

LeCroy Corporation

SierraFC M8-4 API Reference Manual

Manual Version 1.00

25

4.1.3 ITrace::Save


HRESULT Save (

[in] BSTR file_name,
[in, defaultvalue(-1)] long packet_from,
[in, defaultvalue(-1)] long packet_to );

Saves trace into a file while allowing you to specify a range of packets.

Parameters

file_name

String providing the full pathname to the file where the trace is saved

packet_from

Beginning packet number when you are saving a range of packets,
Value

–1 means that the first packet of the saved trace is the first packet

of this trace.

packet_to

Ending packet number when you are saving a range of packets,
Value

–1 means that the last packet of the saved trace is the last packet

of this trace.

Return values

ANALYZERCOMERROR_UNABLESAVE –

unable to save the trace file

ANALYZERCOMERROR_INVALIDPACKETNUMBER - b

ad packet range

Remarks
Use this method if you want to save a recorded or opened trace into a file. If the display
options apply to this trace (see

ITrace::ApplyDisplayOptions

or

IFCAnalyzer::LoadDisplayOptions

), then hidden packets would not be saved.


If the packet range specified is invalid (for example, packet_to is more than the last packet
number in the trace, or packet_from is less than the first packet number in the trace, or
packet_from is more than packet_to) then the packet range will be adjusted automatically.

Example

WSH:

Set Analyzer = WScript.CreateObject("LeCroy.FCAnalyzer")
CurrentDir = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, "\"))
Set Trace = Analyzer.MakeRecording (CurrentDir & "Input\test_ro.rec")
Trace.ApplyDisplayOptions CurrentDir & "Input\test_do.opt"
Trace.Save CurrentDir & "Output\saved_file.sat"

C++:
IFCTrace* sas_trace;

TCHAR file_name[_MAX_PATH];
LONG packet_from;
LONG packet_to;


. . .

try

{

sas_trace->Save( file_name, packet_from, packet_to );

}
catch (_com_error& er)
{

if (er.Description().length() > 0)
::MessageBox( NULL, er.Description(), _T("SierraFC M8-4 client"), MB_OK
);
else
::MessageBox( NULL, er.ErrorMessage(), _T("SierraFC M8-4 client"), MB_OK
);
return 1;

}