Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CPU Utilization
Message
De
11/07/2006 08:58:57
 
 
À
11/07/2006 03:12:35
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:
01135284
Vues:
11
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.
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform