Bitmap/Write a PPM file: Difference between revisions
→Ada: Make the code compile with the definitions of the referred task in the description.
Alextretyak (talk | contribs) m (→{{header|11l}}: new way of specifying file open mode) |
(→Ada: Make the code compile with the definitions of the referred task in the description.) Tags: Mobile edit Mobile web edit |
||
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 previos 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;
|