Bitwise IO: Difference between revisions
Replace deprecated functions
Alextretyak (talk | contribs) m (→{{header|11l}}: `read_bytes_at_most(n)` -> `read_bytes(at_most' n)`) |
(Replace deprecated functions) |
||
Line 3,486:
}</syntaxhighlight>
=={{header|Seed7}}==
The Seed7 library [
several functions to do bitwise I/O. Bitwise data can be read from (or written to) a string or a file.
The direction of bits can be from LSB (least significant bit) to MSB (most significant bit) or vice versa.
In the program below the functions
[
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";
Line 3,517:
const proc: finishWriteAscii (inout file: outFile, inout integer: bitPos) is func
begin
putBitsMsb(outFile, bitPos, 0, 7); # Write a terminating NUL char.
write(outFile, chr(ord(outFile.bufferChar)));
end func;
const
result
var string: stri is "";
Line 3,531 ⟶ 3,527:
var char: ch is ' ';
begin
while
ch := chr(
if
stri &:= ch;
end if;
Line 3,543 ⟶ 3,539:
var file: aFile is STD_NULL;
var integer: bitPos is 0;
var msbBitStream: aBitStream is msbBitStream.value;
begin
aFile :=
initWriteAscii(aFile, bitPos);
writeAscii(aFile, bitPos, "Hello, Rosetta Code!");
finishWriteAscii(aFile, bitPos);
seek(aFile, 1);
writeln(literal(readAscii(
end func;</syntaxhighlight>
Line 3,557 ⟶ 3,554:
"Hello, Rosetta Code!"
</pre>
=={{header|Tcl}}==
<syntaxhighlight lang="tcl">package require Tcl 8.5
|