Bitmap/Write a PPM file: Difference between revisions
→Ada: Fixed tipo an better reference
Alextretyak (talk | contribs) m (→{{header|11l}}: new way of specifying file open mode) |
(→Ada: Fixed tipo an better reference) Tags: Mobile edit Mobile web edit |
||
(One intermediate revision by the same user not shown) | |||
Line 204:
<syntaxhighlight lang="ada">with Ada.Characters.Latin_1;
with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO;
with Bitmap_Store; use Bitmap_Store;
-- This package is defined in the Bitmap task.
procedure Put_PPM (File : File_Type; Picture : Image) is
Line 229 ⟶ 232:
end Put_PPM;</syntaxhighlight>
The solution writes the image into an opened file. The file format might fail to work on certain [[OS]]es, because output might mangle control characters like LF, CR, FF, HT, VT etc. The OS might also limit the line length of a text file. In general it is a bad idea to mix binary and text output in one file. This solution uses ''stream I/O'', which should be as portable as possible.
=={{header|Aime}}==
<syntaxhighlight lang="aime">integer i, h, j, w;
|