2.1.13.1 AscImpReadFileStruct


Description

Scan and analyse the given file to gather information for ascii import into worksheets. This function will look read the file to look for consistent structure by trying different separators that will yield the largest number of columns.

Syntax

int AscImpReadFileStruct( LPCSTR lpcszFilename, ASCIMP * pASCIMPstruct, DWORD dwCntrl = 0 )

Parameters

lpcszFilename
[input] a full path ASCII file name
pASCIMPstruct
[output]pointer to an ASCIMP struct that is not initialized on input but will be set when function returns
dwCntrl
[input]additional flags to control the reading, only AIRF_USE_ASCIMP is defined for now. when dwCntrl = 0, pASCIMPstruct to be used only as output, if AIRF_USE_ASCIMP, then it will be used as starting point for further scanning

Return

Returns 0 if no error, otherwise an error code is returned

Examples

EX1

void AscImpReadFileStruct_ex1()
{
    ASCIMP    ascimp;
    string strFile = GetOpenBox("*.dat");
    if(AscImpReadFileStruct(strFile,&ascimp)==0)
    {
        out_int("# of header lines= ", ascimp.iHeaderLines);
        out_int("# of columns = ", ascimp.iNumColumns);
    }
}

Remark

See Also

Header to Include

origin.h

Reference