I/O function
Laura Brody
laura at hvcomputer.com
Mon Feb 7 12:00:59 PST 2011
Quoting Brandt Eppler <beppler300 at verizon.net>:
> Hi
>
> Does anyone have a simple sample of code using the i/o functions?
>
> All I need to do is open a file and write 1 line of data to it at
> a time.
>
From my "Laura's Quick Reference Guide and filePro Help File"
product (available at www.hvcomputer.com):
@@@ WRITE()
v4.5 \r n = WRITE(handle,str [,n] ) \r - Write data to a file.
The str is the data to write to the file. The
last parameter specifies the number of bytes to write.
If omitted, the entire contents of str is written. The
return value is the number of bytes written.
Example:
then: declare local handle(8,.0)
then: handle = create("/tmp/myfile.dat","rwt")
if: handle le "0" ' Create failed.
then: end
then: x = WRITE(handle,"This is a test") ' x will contain 14.
then: x = WRITE(handle, at T4) ' x will contain 10.
See also: CREATE(), OPEN(), READ(), READLINE(), WRITELINE()
@@@ WRITELINE()
v4.5 \r n = WRITELINE(handle,str [,n] ) \r - Write data to a file,
appending a newline character. The str is the data to
write to the file. The last parameter specifies the number
of bytes to write, not including the newline. If omitted, the
entire contents of str is written. The return value is the
number of bytes written.
Example:
then: declare local handle(8,.0)
then: handle = open("/tmp/myfile.dat","rwt")
if: handle le "0" ' Open failed.
then: end
then: seek(handle,"0","e") 'position to end of file
then: x = WRITELINE(handle,"This is a test") ' x will contain 15 under
' UNIX and 16 on DOS.
See also: CREATE(), OPEN(), READ(), READLINE(), WRITE()
> Thanks in advance
>
> Brandt
>
> Brandt Eppler
> 443.677.3539
> beppler300 at verizon.net
>
> Aut viam inveniam aut faciam Magna est Veritas et Praevalebit
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
--
Laura Brody
+------------- Hudson Valley Computer Associates, Inc ----------+
| PO Box 859; 120 Sixth Street http://www.hvcomputer.com |
| Verplanck, NY 10596-0859 Voice mail: (914) 739-5004 |
+------ PC repair locally, filePro programming globally --------+
More information about the Filepro-list
mailing list