Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CPU Utilization
Message
De
11/07/2006 09:39:40
 
 
À
11/07/2006 08:58:57
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows 2000
Database:
Visual FoxPro
Divers
Thread ID:
01135216
Message ID:
01135298
Vues:
13
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform