2.2.5.1.6 file::GetLength

Description

Obtains the current logical length of the file in bytes.

Syntax

DWORD GetLength( )

Parameters

Return

The length of the file.

Examples

EX1

void file_GetLength_ex1()
{
	string strFile = "c:\\test.txt";
	file ff(strFile, file::modeCreate | file::modeWrite);
    vector<float> vf(5);
    for ( int ii = 0; ii < vf.GetSize(); ii++ )
        vf[ii] = ii*1.25;
    ff.WriteFloat(vf, sizeof(float), vf.GetSize());
    ff.Close();
    
    if( ff.Open(strFile, file::modeRead|file::typeBinary) )
    {
        DWORD dwLen = ff.GetLength();
        printf("Length of file %s is %d bytes\n", strFile, dwLen);
        ff.Close();
    }
}

Remark

See Also

Header to Include

origin.h