Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Write in a *.txt file
Message
De
27/02/2006 10:18:47
 
 
À
27/02/2006 04:56:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 8
OS:
Windows XP
Network:
Windows XP
Database:
MySQL
Divers
Thread ID:
01099370
Message ID:
01099442
Vues:
14
>HI all,
>
>How Can I write in a *.txt file
>
>Thanks
Along with what the others said, here is another way to write to a txt file. When I do quick ad hoc PRGs, I usually want to write to a log file. I simply use SET PRINTER commands to do this (you can also use SET ALTERNATE). Here is an example:
SET PRINTER TO updcosts.txt
SET PRINTER on
? "updcosts.txt	-	update costs log"
? DATETIME()
SELECT updlist
SCAN
	SCATTER NAME oiv
	? iv_number+ " "
	IF SEEK(oiv.iv_number,"invntory","iv_number")
		IF invntory.iv_stnum = 0
			?? "qty is zero! CANNOT UPDATE!"
			loop
		ENDIF 
		SCATTER NAME oinv
		?? " current cost= "
		?? invntory.iv_stval
		?? " new cost= "
		?? oiv.extcost
		IF invntory.iv_stval=oiv.extcost
			?? "...no change necessary!"
		ELSE
		endif
	ELSE
.
.
.
ETC.......
.
.
.

		?? " item not found in invntory!"
	ENDIF
ENDSCAN 	
SET PRINTER off
SET PRINTER to
The resulting TXT log file looks like this:

updcosts.txt - update costs log
03/02/2005 07:22:40 PM
*22SG1775C item not found in invntory!
*22WW17.75 item not found in invntory!
16LZ4825CO current cost= 1110.28 new cost= 6071.26 OUT trx cut, IN trx cut
208V3600CO current cost= 0.00 new cost= 4774.08 OUT trx cut, IN trx cut
20AM3600CO current cost= 0.00 new cost= 0.00...no change necessary!
26TR4425CO qty is zero! CANNOT UPDATE!

Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform