Share via


CommaIo.writeExp(Object[]) Method

Definition

Writes the content of a container to a file.

public:
 override bool writeExp(cli::array <System::Object ^> ^ _data);
public override bool writeExp (object[] _data);
override this.writeExp : obj[] -> bool
Public Overrides Function writeExp (_data As Object()) As Boolean

Parameters

_data
Object[]

The container that holds data for the record.

Returns

true if the operation succeeds; otherwise, false. If the operation fails, you can check the status to learn the cause of the failure.

Remarks

The entries in the container are treated as fields. The container itself is treated as a full record. Fields are separated by the delimiter that is specified by using the outFieldDelimiter method. Records are separated by the delimiter that is specified by using the outRecordDelimiter method.

This example uses a CommaIO object to read from the example file.

{ 
    container c; 
    CommaIo myfile; 
    FileIoPermission perm; 
    #define.ExampleFile(@"c:\myfile.txt") 
    #define.ExampleOpenMode("w") 
    // Set code access permission to help protect the use 
    // of CommaIO.new 
    perm = new FileIoPermission(#ExampleFile, #ExampleOpenMode); 
    perm.assert(); 
    myfile = new CommaIo(#ExampleFile, #ExampleOpenMode); 
    // Assign the entries in the container according to record layout. 
    c = [1,"MyText",1.324,"Last field"]; 
    // Write this record according to file format  
    // (record/field delimiters). 
    myfile.writeExp(c); 
    // Close the code access permission. 
    CodeAccessPermission::revertAssert(); 
}

Applies to