Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CPU Utilization
Message
From
11/07/2006 09:39:40
 
 
To
11/07/2006 08:58:57
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Environment versions
Visual FoxPro:
VFP 6
OS:
Windows 2000
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01135216
Message ID:
01135298
Views:
12
With all due respect, Tracy. I'd be surprised, very surprised if that function were faster than file() with all those statements and two declares


>I'm not sure, but this may be safer (and faster) than IF FILE():
>
>CLEAR
>
>LOCAL lcFileToFind, llokay
>lcFileToFind = "\mydirectory\mfile.txt"
>llokay = findmyfile(lcFileToFind)
>? llokay
>RETURN
>
>FUNCTION findmyfile(tcFilename)
>
>DECLARE LONG FindFirstFile IN Kernel32 AS funcFindFirst ;
>	STRING cFileName, STRING @WIN32_DATA
>DECLARE FindClose IN Kernel32 AS funcFindClose LONG hHandle
>
>LOCAL lcFileName, lcBuffer, lcFilePath, llReturn
>lcFilePath = ADDBS(JUSTPATH(tcFilename))
>lcFileName = JUSTFNAME(tcFilename)
>lcBuffer = REPLICATE(CHR(0), 318)
>hHandle = funcFindFirst(tcFilename, @lcBuffer)
>IF (hHandle > 0)
>	lcFileName = SUBSTR(lcBuffer, 45)
>	lcFileName = LEFT(lcFileName, AT(CHR(0), lcFileName)-1)
>	? lcFileName
>	funcFindClose(hHandle)
>	llReturn = .T.
>ELSE
>	? lcFilePath+lcFileName+" Does NOT Exist"
>	llReturn = .F.
>ENDIF
>CLEAR DLLS funcFindFirst, funcFindClose
>RETURN llReturn
>
>Also, just as a test, if instead of an APPEND, if you step through the file and copy records one at a time (while slower), does the CPU Utilization still max out? I'm curious because I have seen CPU Utilization jump up to 90% doing an append in the past.
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform