FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour ttxtfile():new() return nil if error opening file.
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
ttxtfile():new() return nil if error opening file.
Posted: Thu May 11, 2006 01: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

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
ttxtfile():new() return nil if error opening file.
Posted: Thu May 11, 2006 07:53 PM

Gale,

Fixed. Thanks!

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion