Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

31337

Memory Location to FILE *

This topic is 5225 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there anyway to make a FILE * point to a spot in memory? I know that with fread() for the FILE * you can pass it stdin.

Share this post


Link to post
Share on other sites
Advertisement
Technically you could make a FILE * pointer point to a space in memory, like so:


FILE *p = (FILE*)0x48181561894; // Memory address



but it wont do you any good. fread only wants to receive fp structures that either point to a stream or file. and as stdin is a stream its fine, just like stdout, stderr, stdprn, etc.

But why do you want a FILE * to point to a place in memory??

Share this post


Link to post
Share on other sites
Well, here''s the problem.

I''m modifying a program and extending it to be a web service. Currently you can see what the GUI will look like here: http://phage.sdsu.edu/poole/ibd.html

The program (IBD) has already been written to read in a file, but with CGI (I''m using post in my form) it sends the file over at a spot in memory. So I need to copy that spot in memory over to a buffer (speaking of which, what is the best way to tell how large the file is from the cgi script?) and then parse it.

Unfortuneatly the parsing code has all been written using file input and output. I could move the code over to being memory based functions but I figure this would just cause bugs and what-not.

So basically, I was looking for an easy work around so that I wouldn''t have to change all of the parsing code. Thanks for your post.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!