Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Closing All Files Opened with FOpen
Message
 
 
To
21/11/2001 11:54:53
Jay Johengen
Altamahaw-Ossipee, North Carolina, United States
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00584535
Message ID:
00584563
Views:
32
This message has been marked as a message which has helped to the initial question of the thread.
Along the same lines as Daniel's:
clear
local lctemp, lcstr, lnpos
lctemp = 'TMP' + sys(2015) + '.txt'
display status to file &lctemp noconsole

lcstr = filetostr(lctemp)
lnpos = at('USER-OPENED FILES:',upper(lcstr))
if lnpos > 0 then
	lcstr = substr(lcstr,lnpos)
	lcstr = left(lcstr,at('FILE SEARCH PATH:',upper(lcstr))-1)
	
	local array lafiles[1]
	local lxx, lch, lnh
	for lxx = 1 to alines(lafiles,lcstr)
		lnpos = at('HANDLE=',upper(lafiles[lxx]))
		if lnpos > 0 then
			lch = substr(lafiles[lxx],lnpos + 7)
			lch = left(lch, at(' ',lch)-1)
			lnh = val(lch)
			if lnh > 0 then
				=fclose(lnh)
			endif
		endif
	endfor
endif

delete file (lctemp)
HTH.

>I better add that my specific problem is not "Close All" is not closing the files, rather that I don't want to use it. Any way to loop through all open files and close them individually?
>
>Renoir
>
>
>>Following is a snip of code from an app the guy before me wrote. Dots just mean that there was irrelevant code between the lines. He issues a Close All in order to make sure the ASCII files are closed before continuing the process. This causes problems for me - both in reality and my sense of order. How do I handle closing any files that were opened with FOpen/FCreate do this is not an issue? Thanks!
>>
>>Regards, Renoir
>>
>>
>>* - not closing all left some ascii files open, causing conflicts
>>
>>Close ALL
>>.
>>.
>>.
>>m.filein2='C:\SFW\DATA\'+m.filein
>>.
>>.
>>.
>>m.fileout=SUBSTR(m.filein,1,AT('.',m.filein))+'ERR'
>>m.handlein = FOPEN(m.filein2,0)
>>m.handleout= FCREATE(m.fileout,0)
>>
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Reply
Map
View

Click here to load this message in the networking platform