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

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

Postby Gale FORd » 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
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Postby Antonio Linares » Thu May 11, 2006 7:53 pm

Gale,

Fixed. Thanks!
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42099
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 75 guests