Jump to content

Bitmap/Write a PPM file: Difference between revisions

Forth
(added C)
(Forth)
Line 16:
fflush(fd);
}</C>
 
=={{header|Forth}}==
: write-ppm { bmp fid -- }
s" P6" fid write-line throw
bmp bdim swap
0 <# bl hold #s #> fid write-file throw
0 <# #s #> fid write-line throw
s" 255" fid write-line throw
bmp bdata bmp bdim * pixels
bounds do
i 3 fid write-file throw
pixel +loop ;
 
s" red.ppm" w/o create-file throw
test over write-ppm
close-file throw
 
== {{Header|OCaml}} ==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.