[futurebasic] Re: [FB] Re: Writing to a text file

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2003 : Group Archive : Group : All Groups

From: Joe Lewis Wilkins <PepeToo@...>
Date: Thu, 17 Jul 2003 00:32:49 -0700
Hi Ken,

When you click on the Open Text File Button and then Cancel the 
subsequent Open Dialog, an inappropriate action follows, so I've 
modified the following: (I ADDED TWO LINES IN THE FIRST FN AND 3 LINES 
IN THE NEXT ONE.)


'local mode // HAD TO COMMENT THIS OUT SO GLOBAL gFBQuit CAN BE RECOGNIZED
local fn OpenTextFileToContainer( @CPtr as ptr )
dim as FSSpec f
dim as long   size

long if len( files$( _FSSpecOpen, "TEXT", "Open file to parse", f ))
if CPtr.nil& then DisposeHandle( CPtr.nil& ) : CPtr.nil& = _nil
on error end
open "I", #1, @f
size = lof( 1, 1 )
long if error = _noErr and syserror = _noErr and size > 0
CPtr.nil& = Fn NewHandle( size )
long if fn MemError = _noErr and CPtr.nil& != _nil
HLock( CPtr.nil& )
read file #1, [CPtr.nil&], size
HUnlock( CPtr.nil& )
long if error != _noErr or syserror != _noErr
DisposeHandle( CPtr.nil& ) : CPtr.nil& = _nil
end if
xelse
long if CPtr.nil&
DisposeHandle( CPtr.nil& ) : CPtr.nil& = _nil
end if
end if
end if
close 1
error = _noErr : syserror = _noErr
on error return
xelse  // ADDED THIS LINE
gFBQuit = _true  // ADDED THIS LINE
end if

end fn
----------------------------
//ADDED THREE LINES TO THIS FUNCTION

local fn LaunchProgram
kill dynamic splitArray
kill dynamic arrayB
appearance button 3,,0
edit$(1) = ""
edit$(2) = ""
fn OpenTextFileToContainer( gC )
long if gFBQuit // ADDED THIS LINE
gFBQuit = _false  // ADDED THIS LINE
exit fn // ADDED THIS LINE
end if
fn CaseAndPunctuation( 4, 5)
fn SplitAndSortArray
appearance button 3,,0
end fn

Hope you don't mind my pickyness.

Joe Wilkins

Ken Shmidheiser wrote:
< snip all >