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

Post Reply
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

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

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Post by Antonio Linares »

Gale,

Fixed. Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply