Solved

Save from memory to file

Posted on 1997-08-05
6
197 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
TClientSocket.SendStream is slow... 2 946
VB.Net code to pascal 1 388
Capture cookies with delphi 5 991
File restrict, lock. 4 210
Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In  today’s increasingly digital world, managed service providers (MSPs) fight for their customers’ attention, looking for ways to make them stay and purchase more services. One way to encourage that behavior is to develop a dependable brand of prod…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now