Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
StrToFile Equivalent in FPD26?
Message
De
10/02/2003 14:07:31
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00751416
Message ID:
00751562
Vues:
21
Thanks for looking that up for me Nadya. I appreciate it! I will have to check out SET ALTERNATE and SET TEXTMERGE to see if I gain anything. For what it's worth, I tested fwrite() and I also wanted to run the code like
a function to return a value, so I tested the code below. It works in FPD26 also. The code in the mcode field is 130 lines of code and reads information from .ini files (I copied a .prg into it manually for testing
purposes):
*!***************************************************************
* codefile1.prg
*!***************************************************************
* FPD26 Example only
* Creates a table that stores a code name and code code
* Allows program code to be compiled and run on the fly by seeking
* the program name to run (stored in cprogram character field)
* and running the associated code (stored in mcode memo field)
*
SET TALK OFF
CLEAR
IF FILE('codefile.dbf')
	USE codefile ALIAS codefile ORDER TAG cprogram
ELSE
	RETURN
ENDIF
lcfunction=""
lcFileName = SYS(2015)
lcDelete=lcFileName + ".fxp"
lcFileName=lcFileName+".prg"
IF SEEK('get_ini','codefile','cprogram')
	IF !FILE(lcFileName)
		xfileh = FCREATE(lcFileName)
	ELSE
		xfileh = FOPEN(lcFileName,2)
	ENDIF
	IF xfileh=0
		WAIT WINDOW "Cannot create the program." NOWAIT
	ELSE
		=FCHSIZE(xfileh,0)
		FOR i = 1 TO LEN(codefile.mcode)
			=FWRITE(xfileh,SUBSTR(codefile.mcode,i,1))
		ENDFOR
		=FCLOSE(xfileh)
	ENDIF
	IF FILE(lcFileName)
		wkinifile = LEFT(SYS(2019),RAT('\',SYS(2019)))+'WORKSTAT.INI'
		PUBLIC lPointSize
		PUBLIC xreturn
		PUBLIC lcresult
		DO (lcFileName) WITH wkinifile,'[Defaults]','FontSize'
		lcfunction=LEFT(lcfilename,AT('.',lcfilename)-1)
	        commandline="lPointsize="+;
                    lcfunction+"(wkinifile,'[Defaults]','FontSize')"
		&commandline
		?lPointSize
	ENDIF
ELSE
	WAIT WINDOW "Could Not Find Program to Run." AT 22,35
ENDIF
IF USED('codefile')
	USE IN codefile
ENDIF
IF FILE(lcFileName)
	DELETE FILE (lcFileName)
ENDIF
IF FILE(lcfunction)
	DELETE FILE (lcFunction)
ENDIF
IF FILE(lcDelete)
	DELETE FILE (lcDelete)
ENDIF
RETURN
.·*´¨)
.·`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
Répondre
Fil
Voir

Click here to load this message in the networking platform