>Hi
>Could someone point out what is probably blindingly obvious - I can not get the following code to write to local text file?
>jn returns 0 each time through the loop.
>
>(I am creating and closing the file before opening it again because in my application the file creation is done in a separte method to the writing of text to the file.)
>
>
>
>USE USERS IN 0
>lcfname = "C:\temp\testfile.txt"
>lnhandle = FCREATE(lcfname)
>FCLOSE(lnHandle)
>lnHandle=FOPEN(lcFname,12)
>SELECT USERS
>SCAN
> jctext = USER+","+NAME
> * Write the record
> jn=fputs(lnhandle,jctext)
>ENDSCAN
>
>=fclose(lnhandle)
>
>
>
>
>Thanks
>Barry Sutton
If you can, try using the good ol' copy to command....
COPY FIELDS USER,NAME TO (m.lcFname) DELIMITED WITH "" WITH CHARACTER ','
It will create the file, write to it and close the file in one shot.