FileGetCol Function

Action

Retrieves the value of the column specified by nColumn of the current row.

Include file

Kernel.bdh

Syntax

FileGetCol( in hFile   : number,
            in nColumn : number,
            in nMaxLen : number optional ): string;

Return value

value of the column

Parameter Description
hFile Specifies the file handle that is used to access the file.
nColumn Number of the column beginning with 1 for the first column. If you set nColumn to 0, the whole row is retrieved.
nMaxLen

(optional, default = STRING_COMPLETE)

Maximum length of the return value including the terminating null character. If a column value including terminating null character is larger than this value, the return value is truncated accordingly.

Example

dcltrans
  transaction TMain
  const
    MAX_LEN := 254;
  var
    hFile, i : number;
    sRowBuffer, sColumn1, sColumn2 : string;
  begin
    ...
    FileFixedLoad(hFile, "login.csv", "1..20;21-40");
    
    for i := 1 to 100 do
      FileGetRow(hFile, i);
      sRowBuffer := FileGetCol(hFile, 0, MAX_LEN);
      sColumn1   := FileGetCol(hFile, 1, MAX_LEN);
      sColumn2   := FileGetCol(hFile, 2, MAX_LEN);
    end;
    ...
  end TMain;

Sample scripts

RandomLogin.bdf