Shell Commands/FileWrite

From MorphOS Library

Revision as of 17:27, 24 January 2017 by JPV (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

< Shell Commands

FileWrite - Writes data to a file

FILE/A, SIZE/N/A, DATA/N, STRING, ADD/S

FILE   - Filename to write data to
SIZE   - Amount of data in bytes to be written
DATA   - Data to be written in hex
STRING - Data in the string format
ADD    - Adds data to an existing file instead of creating a new file

If the length of data is shorter than the size value, the file is filled by repeating the data contents. Strings get separated by null bytes then. Data entered in decimals gets converted to hex. If no data is given, the file is filled with null bytes.

Examples:

Ram Disk:> FileWrite test 8 0x4d4f5321
Ram Disk:> Type test HEX
0000: 4D4F5321 4D4F5321                   MOS!MOS!

Ram Disk:> FileWrite test 32 STRING MorphOS
Ram Disk:> Type test HEX
0000: 4D6F7270 684F5300 4D6F7270 684F5300 MorphOS.MorphOS.
0010: 4D6F7270 684F5300 4D6F7270 684F5300 MorphOS.MorphOS.

Ram Disk:> FileWrite test 4 STRING MorphOS
Ram Disk:> Type test HEX
0000: 4D6F7270                            Morp

Ram Disk:> FileWrite test 4 STRING MorphOS ADD
Ram Disk:> Type test HEX
0000: 4D6F7270 4D6F7270                   MorpMorp

To create an empty ADF image (which can then be mounted with Tools/FileImageCtrl and formatted with Tools/Format under MorphOS, or just be used in an Amiga emulator):

Ram Disk:> FileWrite empty.adf 901120