2.2.3.4.2 Curve::Create

Description

Create an internal Origin data set (may or may not be temporary).

Syntax

BOOL Create( int Size, UINT Option = 0 )

Parameters

Size
[input] Size of the data set
Option
[input] Option=0 (default) causes temporary Origin data set to be automatically deleted when program control exits scope of Dataset object, Option=1 causes data set to not be deleted unless user calls Dataset::Destroy method

Return

Returns TRUE on successful exit and FALSE on error.

Examples

EX1

void Curve_Create_ex1()
{
    int ii; 
    LT_execute("list s;");
    {
		Curve    crv0;
		crv0.Create(3);             // Size=3 & Option=0 by default (create and attach to temporary data set)
		for(ii = 0; ii < 3; ii++)
			crv0[ii] = ii;
    }
    LT_execute("list s;");      // Out of crv0's scope, note new crv0 TEMP_ data set is destroyed
 
    Curve    crv1;
    crv1.Create(3,1);           // Size=3 & Option=1 (create and attach to a second data set that is not temporary)
    for(ii = 0; ii < 3; ii++)
        crv1[ii] = ii;
    LT_execute("list s;");      // Note new crv1 TEMP_ data set
    crv1.Destroy();             // Destroy crv1 TEMP_ data set (comment out this line and TEMP_ data set does not get deleted)
    LT_execute("list s;");      // Note new crv1 TEMP_ data set is destroyed (or not if above line is commented out)
}

Remark

Create a temporary (or permanent) Origin data set and attach the Dataset object to it. If Option=1 is specified and data set is not destroyed by calling the Dataset::Destroy method the data set will remain in Origin after the Origin C function completes execution.

See Also

Dataset::Destroy, Dataset::Detach, Dataset::Dataset, Dataset::Attach

Header to Include

origin.h