Solved

Saving Pointers To Fies

Posted on 1998-10-22
3
139 Views
Last Modified: 2011-10-03
I'm working on a 3D Scrolling engine for pascal in which I am using the function Getimage to save portions of the screen to files.  The problem is when using a pointer, you are only saving the memory location of the image not what is actually at the pointer location.  I was wondering if anyone knew if and how this is can be accomplished.  I do not know assembly language and would appreciate an answer without it.
0
Comment
Question by:Corey080698
3 Comments
 
LVL 5

Accepted Solution

by:
scrapdog earned 100 total points
ID: 1215844
Are you using Turbo Pascal?

You could do it this way:

Declare this variable:

var Image :Pointer;

And in your code:

Size := ImageSize(x1,y1,x2,y2);
GetMem(Image, Size);
GetImage(x1,y1,x2,y2,Image^);

{open your file here (a file of bytes)}

to write to the file:

BlockWrite(File, Image^, Size, Result);  {result returns number of bytes sent to file}


When you are done with the image buffer:

FreeMem(Image, Size);




0
 
LVL 2

Expert Comment

by:omsec
ID: 1215845
if you have a pointer variable it's always same :

Var
  Something : Pointer;

"Something" is the Pointer (xxxx:yyyy)
and
"Something^" is the Data where the Pointer points to
0
 

Author Comment

by:Corey080698
ID: 1215846
I tried the above answers, but neither of them are working...when i reload the image to a pointer variable from the file, its not coming acrossed as it was saved or not at all.  Any more sugestions?
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

There are many Password Managers (PM) out there to choose from. PM's can help with your password habits and routines, but they should not be a crutch you rely on too heavily. I also have an article for company/enterprise PM's.
With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

16 Experts available now in Live!

Get 1:1 Help Now