2.2.3.6.3 Dataset::Create

Description

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

Syntax

BOOL Create( int Size, UINT Option = 0, LPCSTR lpcszNamePrefix = NULL )

Parameters

Size
[input] Size of the data set
Option
[input]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
lpcszNamePrefix
[input] name prefix of the new Dataset

Return

Returns TRUE on successful exit and FALSE on error.

Examples

EX1

void Dataset_Create_ex1()
{
    int ii;
    {
        LT_execute("list s;");
        Dataset    ds0;
        ds0.Create(3);         // Size=3 & Option=0 by default (create and attach to temporary data set)
        for(ii = 0; ii < 3; ii++)
            ds0[ii] = ii;
        LT_execute("list s;"); // Note new ds0 TEMP_ data set
    }
    LT_execute("list s;");     // Out of ds0's scope, note new ds0 TEMP_ data set is destroyed
        
    Dataset    ds1;
    ds1.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++)
        ds1[ii] = ii;
    LT_execute("list s;");     // Note new ds1 TEMP_ data set
    ds1.Destroy();             // Destroy ds1 TEMP_ data set (comment out this line and TEMP_ data set does not get deleted)
    LT_execute("list s;");     // Note new ds1 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