file::WriteFloat

Description

Write a set of float data into file.

Syntax

UINT WriteFloat( void * pSrcBuffer, int nDataTypeSize, UINT nItemCount, BOOL bIsLittleEndian = TRUE )

Parameters

pSrcBuffer
[input] Destination's buffer of store the int value
nDataTypeSize
[input] Must be size of datatype. for integer, 1, 2 and 4. for float, 4 and 8.
nItemCount
[input] Number of data;
bIsLittleEndian
[input] TRUE, use Little Endian way, FALSE use Big Endian way, default value is TRUE.

Return

The number of items read from file.

Examples

EX1

void file_WriteFloat_ex1()
{
        file ff("C:\\float.txt", 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();
        
        file fr("C:\\float.txt", file::modeRead);
        vector<float> ve(5);
        fr.ReadFloat(ve, sizeof(float), ve.GetSize());
        fr.Close();
        //vf and ve should contain same data.
        return;
}

Remark

See Also

file::ReadFloat

header to Include

origin.h