Solved

Save from memory to file

Posted on 1997-08-05
6
204 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

 

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Why do some people recommend buying business VoIP from an ISP? What are the benefits to my company? What are the costs?
Choosing a core focus or particular set of features and options can be tough. To help out, we’re going to highlight a handful of things your business needs on one of your social media pages. In other words, if one of these is missing, you should imp…
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Suggested Courses

623 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