HALCON Reference Manual 10.0.2
Table of Contents / File / Text ClassesClassesClasses | | | Operators

fread_stringfread_stringfread_stringFreadStringFreadString (Operator)

Name

fread_stringfread_stringfread_stringFreadStringFreadString — Read strings from a text file.

Signature

fread_string( : : FileHandle : OutString, IsEOF)

Herror fread_string(const Hlong FileHandle, char* OutString, Hlong* IsEOF)

Herror T_fread_string(const Htuple FileHandle, Htuple* OutString, Htuple* IsEOF)

Herror fread_string(const HTuple& FileHandle, char* OutString, Hlong* IsEOF)

HTuple HFile::FreadString(HTuple* IsEOF) const

void HOperatorSetX.FreadString(
[in] VARIANT FileHandle, [out] VARIANT* OutString, [out] VARIANT* IsEOF)

BSTR HFileX.FreadString([out] Hlong* IsEOF)

static void HOperatorSet.FreadString(HTuple fileHandle, out HTuple outString, out HTuple isEOF)

string HFile.FreadString(out int isEOF)

Description

The operator fread_stringfread_stringfread_stringFreadStringFreadString reads a string from the current input file. A string begins with the first representable character: letters, numbers, additional characters (except blanks). A string ends when a blank or a line skip is reached. Several successive line skips are ignored. If the end of the file is reached IsEOFIsEOFIsEOFIsEOFisEOF return the value 1, otherwise 0.

Parallelization

Parameters

FileHandleFileHandleFileHandleFileHandlefileHandle (input_control)  file HFile, HTupleHFile, HTupleHFileX, VARIANTHtuple (integer) (IntPtr) (Hlong) (Hlong) (Hlong)

File handle.

OutStringOutStringOutStringOutStringoutString (output_control)  string HTupleHTupleVARIANTHtuple (string) (string) (char*) (BSTR) (char*)

Read character sequence.

IsEOFIsEOFIsEOFIsEOFisEOF (output_control)  integer HTupleHTupleVARIANTHtuple (integer) (int / long) (Hlong) (Hlong) (Hlong)

Reached end of file.

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Example (C)

fwrite_string(FileHandle,"Please enter text and return: ..") ;
fread_string(FileHandle,&String,&IsEOF) ;
fwrite_string(FileHandle,"here it is again: ") ;
fwrite_string(FileHandle,String) ;
fnew_line(FileHandle) ;

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Example (HDevelop)

fwrite_string(FileHandle,'Please enter text and return: ..')
fread_string(FileHandle,String,IsEOF)
fwrite_string(FileHandle,['here it is again: ',String])
fnew_line(FileHandle)

Result

If a file is open and a suitable string is read fread_stringfread_stringfread_stringFreadStringFreadString returns the value 2 (H_MSG_TRUE). Otherwise an exception is raised.

Possible Predecessors

open_fileopen_fileopen_fileOpenFileOpenFile

Possible Successors

close_fileclose_fileclose_fileCloseFileCloseFile

Alternatives

fread_charfread_charfread_charFreadCharFreadChar, read_stringread_stringread_stringReadStringReadString, fread_linefread_linefread_lineFreadLineFreadLine

See also

open_fileopen_fileopen_fileOpenFileOpenFile, close_fileclose_fileclose_fileCloseFileCloseFile, fread_charfread_charfread_charFreadCharFreadChar, fread_linefread_linefread_lineFreadLineFreadLine

Module

Foundation


Table of Contents / File / Text ClassesClassesClasses | | | Operators
HALCON Reference Manual 10.0.2 Copyright © 1996-2011 MVTec Software GmbH