Solved

Save from memory to file

Posted on 1997-08-05
6
200 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 80 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Pascal code for reading registry 1 351
ROUND() from fbudf.dll only gives integers 2 1,053
Programmatically drawing the lines in a delphi drawgrid and merge cells 9 1,309
HTTP-POST Delphi 7 5 2,924
Adding Computers to AD groups through an SCCM Task Sequence
In this increasingly digital world, security hacks are no longer just a threat, but a reality. As we've witnessed with Target's big identity hack 2013, Heartbleed in 2015, and now Cloudbleed, companies and their leaders need to prepare for the unthi…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 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