Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Save from memory to file

Posted on 1997-08-05
6
Medium Priority
?
207 Views
Last Modified: 2010-04-16
Hya there, i made this cool drawing program, the drawing is showen on
like a bar(100,100,400,400) and i wanted to know how i can save the drawing to a file. im using the graph unit. all i know is how to save to the memory using getimage, and to load it using putimage, but how can i
save it to a FILE and then to load it?
0
Comment
Question by:yolis
  • 4
  • 2
6 Comments
 

Author Comment

by:yolis
ID: 1215386
Edited text of question
0
 

Accepted Solution

by:
harisis earned 240 total points
ID: 1215387
It is very simple. Just create a file of your buffer that you use with  getimage. For example:

type  
  buffer=array[1..9000] of byte;
var
  b1:buffer;
  f1:file of buffer;
begin
 getimage(100,100,400,400,buffer );
 asign(f1,'myfile.xxx');
 rewrite(f1);
 write(f1,b1);
 close(f1)
end;

 With the procedure "read(f1,b1)" instead of the "write" you can load the buffer from the file and then put it on the screen. Of course in this case you must "reset" the file instead of "rewrite" it.
0
 

Author Comment

by:yolis
ID: 1215388
its not working!!

to use getimage, i must use the command getmem, and to use getmem i need to give it a variable of pointer..,
so.. what to do?

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:yolis
ID: 1215389
its nor working!, i need to use getmem
and getmem only works with pointers!

0
 

Expert Comment

by:harisis
ID: 1215390
First, you don't need to use getmem with the getimage. You can use a simple variable as a buffer as i show you in the example (but of cource the size of the variable must be aproptiate).

Second, if you want to use a pointer as a buffer (and use the getmem to hold the memory for the pointer) a little changes in the example i gave you. You will add the commands for the pointer (getmem e.t.c.) and change the command "write" as follows:

 write(f1,p^)

where p is the pointer you used with getmem.

p.s. Thanks for the points. I 'll try to help you till the end.
0
 

Author Comment

by:yolis
ID: 1215391
Alright!!, it works!!!, Thaaank you!, i would give you more points if i could.. :)

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In a use case, a user needs to close an opened report by simply pressing the Escape (Esc) key. This can be done by adding macro code in Report_KeyPress or Report_KeyDown event.
Mailbox Corruption is a nightmare every Exchange DBA wishes he never has. Recovering from it can be super-hectic if not entirely futile. And though techniques like the New-MailboxRepairRequest cmdlet have been designed to help with fixing minor corr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question