ttxtfile():new() return nil if error opening file.
Posted: Thu May 11, 2006 1:59 pm
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
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