FileTools[Text] - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : File Manipulation : FileTools : FileTools/Text/WriteFloat

FileTools[Text]

  

WriteFloat

  

write a float to a file

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

WriteFloat(file, float, opt1, opt2, ... )

Parameters

file

-

file descriptor or filename

float

-

float to write to the file

opt1, opt2, ...

-

(optional) argument of the form, name or name=string where name is one of delim, leftdelim, or rightdelim

Description

• 

The WriteFloat(file, float) command writes float to the file specified by file.

• 

The WriteFloat function can place delimiters around float while writing.  Without delimiters the characters of two consecutive calls to WriteFloat are continuous in the file and it is impossible to determine the correct location to separate the two floats. Delimiters can be added around the float by specifying, delim, leftdelim, or rightdelim.

• 

The delim option adds delimiters on both sides of the float. The delimiter can be specified by passing delim=string.  If a string is not specified then the delimiter is a single space.

• 

The leftdelim option adds a delimiter before the float. The rightdelim option adds a delimiter after the float. The delimiter can be specified by passing leftdelim=string or rightdelim=string.  If a string is not specified then the delimiter is a single space. The leftdelim and rightdelim options can be used together to specify asymmetric delimiters.  If used in conjunction with delim, the delimiters specified by leftdelim or rightdelim take precedence.

• 

If file is the name of an open file, the file descriptor is obtained automatically.  If file is the name of a file that is not open, it is opened automatically.  If file is an invalid descriptor, an error is raised.

Examples

FileTools[Text][WriteFloat]testfile,12.34

5

(1)

FileTools[Text][WriteCharacter]testfile, :

FileTools[Text][WriteFloat]testfile,121.3121

8

(2)

FileTools[Text][Close]testfile:

FileTools[Text][ReadFloat]testfile

12.34

(3)

FileTools[Text][ReadFloat]testfile

121.3121

(4)

FileTools[Remove]testfile

FileTools[Text][WriteFloat]testfile,1.234,'delim':

FileTools[Text][WriteFloat]testfile,1.213121,'delim'=::

FileTools[Text][Close]testfile:

FileTools[Text][ReadCharacter]testfile

(5)

FileTools[Text][ReadFloat]testfile

1.234

(6)

FileTools[Text][ReadCharacter]testfile

(7)

FileTools[Text][ReadCharacter]testfile

:

(8)

FileTools[Text][ReadFloat]testfile

1.213121

(9)

FileTools[Text][ReadCharacter]testfile

:

(10)

FileTools[Remove]testfile

FileTools[Text][WriteFloat]testfile,1.7,'rightdelim'=::

FileTools[Text][WriteFloat]testfile,2.9:

FileTools[Text][WriteFloat]testfile,3.3,'leftdelim'=::

FileTools[Text][Close]testfile:

FileTools[Text][ReadFloat]testfile

1.7

(11)

FileTools[Text][ReadCharacter]testfile

:

(12)

FileTools[Text][ReadFloat]testfile

2.9

(13)

FileTools[Text][ReadCharacter]testfile

:

(14)

FileTools[Text][ReadFloat]testfile

3.3

(15)

FileTools[Text][ReadCharacter]testfile

FileTools[Remove]testfile

See Also

file

FileTools[AtEndOfFile]

FileTools[Remove]

FileTools[Text]

FileTools[Text][Close]

FileTools[Text][Open]

FileTools[Text][ReadCharacter]

FileTools[Text][ReadFloat]

FileTools[Text][ReadNextFloat]

FileTools[Text][ReadString]

IO_errors

 


Download Help Document

Was this information helpful?



Please add your Comment (Optional)
E-mail Address (Optional)
What is ? This question helps us to combat spam