Page 1 of 1

ttxtfile():new() return nil if error opening file.

PostPosted: Thu May 11, 2006 1:59 pm
by Gale FORd
If there is a file error, method new() returns nil, but should return self.

METHOD New( cFileName, nMode ) CLASS TTxtFile

Super:New( cFileName, nMode )

IF ::hFile < 0
RETU NIL
// RETU NIL above
// gives an error with xHarbour builder
// I changed this to RETU self
// and now to check for open error
// I check oFile:hFile for < 0
ENDIF

::nMaxLineLength := 1024
::nLine := 1
::nTLines := ::Count( CRLF )
::nOffset := 0
::ReadLine()

RETURN Self

PostPosted: Thu May 11, 2006 7:53 pm
by Antonio Linares
Gale,

Fixed. Thanks!