writes byte or word in a given binary format
mput(x [,type,fd])
:x a vector of floating point or integer type numbers : :fd scalar. The fd parameter returned by the function. Default
value is -1 which stands for the last ( mopen) opened file.
:
The mput function writes data to the output specified by the stream parameter fd. Data is written at the position at which the file pointer is currently pointing and advances the indicator appropriately.
The type parameter is a conversion specifier which may be set to any of the following flag characters (with default value “l”):
:
filen = 'test.bin';
`mopen`_(filen,'wb');
mput(1996,'l');mput(1996,'i');mput(1996,'s');mput(98,'c');
// force little-endian
mput(1996,'ll');mput(1996,'il');mput(1996,'sl');mput(98,'cl');
// force big-endian
mput(1996,'lb');mput(1996,'ib');mput(1996,'sb');mput(98,'cb');
`mclose`_();
`mopen`_(filen,'rb');
if 1996<>`mget`_(1,'l') then pause,end
if 1996<>`mget`_(1,'i') then pause,end
if 1996<>`mget`_(1,'s') then pause,end
if 98<>`mget`_(1,'c') then pause,end
// force little-endian
if 1996<>`mget`_(1,'ll') then pause,end
if 1996<>`mget`_(1,'il') then pause,end
if 1996<>`mget`_(1,'sl') then pause,end
if 98<>`mget`_(1,'cl') then pause,end
// force big-endian
if 1996<>`mget`_(1,'lb') then pause,end
if 1996<>`mget`_(1,'ib') then pause,end
if 1996<>`mget`_(1,'sb') then pause,end
if 98<>`mget`_(1,'cb') then pause,end
`mclose`_();