Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating ASCII Text Files
Message
From
09/12/2002 12:33:04
Rebecca Stottlemire
Kansas State Department of Commerce
Topeka, Kansas, United States
 
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00730853
Message ID:
00731000
Views:
10
Hi, I used Q277725, which has basically the same code. It worked fine!
Thanks,
Becky

>you could try this code i've made
>
>_FileHandler = FCREATE('yourTxtFile.txt')
>
>*:couldn't create the file
>if _FileHandler = -1
>	return
>Endif
>
>Select 0
>Use yourTable
>scan
>	_NumberOfFields=FCOUNT()
>	_FieldString = ""
>	For _X = 1 TO _NumberOfFields
>		*:Getting the name of the field
>		_Campo = FIELD(_X)
>		*:Verify the data type
>		_VariableType = TYPE(FIELD(_X))
>		
>		*:Converting any type of data to string
>		Do Case
>			Case _VariableType = [N]
>				_VariableChar = Alltrim(Str(&_Campo))
>			Case _VariableType = [D]
>				_VariableChar = DTOC(&_Campo)
>			Case _VariableType = [L]
>				_VariableChar = &_Campo
>				_VariableChar = IIF(_VariableChar,[.T.],[.F.])
>			OtherWise
>				_VariableChar = &_Campo
>		EndCase
>	        *:Building the string of using '$' as a separator, change the separator as needed
>		_FieldString = _FieldString + IIF(_X=_NumberOfFields,_VariableChar,_VariableChar + [$])
>	EndFor
>	*:Writing the data in the file
>	=FPUTS(_FileHandler,_FieldString)
>EndScan
>=Fclose(_FileHandler)
>Modi comm 'yourTxtFile.txt'
>Return
>
>
>
>let me know if this helps
Previous
Reply
Map
View

Click here to load this message in the networking platform