write data to a compressed file - Maple Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Input and Output : File Manipulation : FileTools : FileTools/Compressed/Write

FileTools[Compressed][Write] - write data to a compressed file

Calling Sequence

Write(file, data)

Parameters

file

-

string or integer file descriptor

data

-

string or rtable of hardware datatype numbers

Description

• 

The Write command compresses and writes data to a file that has been opened with FileTools[Compressed][Open].

Examples

file := FileTools[TemporaryFilename](cat(FileTools[TemporaryDirectory](),kernelopts(dirsep),"GZtest-"));

file:=/mnt/tmpfs/mpldoc_slot1/mpldoc1/GZtest-h9gGbgMG

(1)

fd := FileTools[Compressed][Open](file);

fd:=8710480

(2)

FileTools[Compressed][Write](fd, "String1");

7

(3)

data := StringTools[ToByteArray]("String2");

data:=8311611410511010350

(4)

FileTools[Compressed][Write](file, data);

7

(5)

FileTools[Compressed][Close](fd);

0

(6)

FileTools[Compressed][ReadFile](file, string);

String1String2

(7)

FileTools[Remove](file);

zipfile := FileTools[TemporaryFilename](cat(FileTools[TemporaryDirectory](),kernelopts(dirsep),"GZtest-"),".zip");

zipfile:=/mnt/tmpfs/mpldoc_slot1/mpldoc1/GZtest-QJvmGwj6.zip

(8)

fd := FileTools[Compressed][Open]("dataOne" in zipfile,'mode'=WRITE);

fd:=0

(9)

FileTools[Compressed][Write](fd, "String1");

7

(10)

FileTools[Compressed][Write](fd, " String2");

8

(11)

FileTools[Compressed][Close](fd);

0

(12)

FileTools[Compressed][ReadFile]("dataOne" in zipfile, string);

String1 String2

(13)

FileTools[Remove](zipfile);

See Also

FileTools[Compressed], FileTools[Compressed][Close], FileTools[Compressed][Open], FileTools[Compressed][Read], FileTools[Compressed][ReadFile], FileTools[Remove]


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