beautypg.com

3 itrace::save, Parameters, Remarks – Teledyne LeCroy Automation API for Teledyne LeCroy PETracer_PETrainer User Manual

Page 36: Example, Itrace::save

background image

Teledyne LeCroy

Automation API for PETracer/PETrainer

31

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 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

Bad packet range

Remarks

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

applied to this trace (see

ITrace::ApplyDisplayOptions on Page 27

or

IAnalyzer::LoadDisplayOptions on Page

14), 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 is adjusted automatically.

Example

WSH:

Set Analyzer = WScript.CreateObject( “CATC.PETracer” )
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.pex"

C++:

IPETrace* pe_trace;
TCHAR file_name[_MAX_PATH];
LONG packet_from;
LONG packet_to;

. . .
try

{

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

}
catch ( _com_error& er)
{

if (er.Description().length() > 0)

::MessageBox( NULL, er.Description(), _T("PETracer client"), MB_OK );

else

::MessageBox( NULL, er.ErrorMessage(), _T("PETracer client"), MB_OK );

return 1;

}