Computer Science Canada
File Manipulation - Code
|Author:||homer [ Wed Dec 01, 2004 9:56 pm ]|
|Post subject:||File Manipulation - Code|
Hey I'm trying to accomplish the following
-Create File using randomly generated dots write to file
-insert "|" to seperate dots, and ">" to go to next line.
-Read file and display image using file data
Encrypt/Compress File: I'm not sure what this would technically be called I think it is closer to encryption.
-look for the most frequently occuring colors
Search for largest string, and decend to the smallest re-occuring string
var fileName : string := "apple.gmp"
var fileNo : int
var inputVariable : string (100)
var streamnumber : int
var count : int := 0
var trow : int := 1
open : streamnumber, fileName, put, mod, seek
for x : 1 .. 5
for y : 1 .. 5
var c : int := Rand.Int (1, maxcolor)
drawdot (x, y, c)
count += 1
if count = 5 then
put : streamnumber, c, ">" ..
count := 0
put : streamnumber, c, "|" ..
seek : streamnumber, *
put : streamnumber, "GMP"
close : streamnumber
open : fileNo, fileName, read
read : fileNo, inputVariable
locate (trow, 1)
close : fileNo
|Author:||SuperGenius [ Thu Dec 02, 2004 7:29 pm ]|
take a look through the tutorials section. Read up on external files. As for the encryption/compression, I don't really know what that's about. You could use a shift cipher, or if you want to get really fancy you could make a one-time cipher program, which is the most secure encryption, although it would take a lot more work.