Path: utzoo!attcan!uunet!mcsun!unido!uniol!reimann From: reimann@uniol.UUCP (Ulf Reimann) Newsgroups: comp.unix.programmer Subject: Re: File pointer to a memory location? Message-ID: <3357@uniol.UUCP> Date: 12 Sep 90 11:30:58 GMT References: <119609@linus.mitre.org> Organization: University of Oldenburg, W-Germany Lines: 26 rtidd@ccels3.mitre.org (Randy Tidd) writes: >So what I have is a block of memory, having exactly the same size and >contents of a file. What I have to do is pass my image processing >routines a file pointer that points to this block of memory. If the >routines used file *descriptors*, it wouldn't be a problem because I >could just use pipes and be done with it. Hi, one way to do it is to set up a FILE structure (see /usr/include/stdio.h for details, it's struct _iobuf) and pass it's address to the routine expecting the file pointer. I once saw that trick in some source to sscanf(). The routine creates an iobuf structure, puts the pointer to the passed string in it (for the buffer) and calls doscanf() which does the desired processing, but with a file pointer. If you have problems doing that, maybe I can write some example code for you, but I'm short on time now... Hope that helps... Ulf #include Ulf Reimann, Hummelweg 30, 2900 Oldenburg, W-Germany, phone +49 (441) 5704245 e-mail: "reimann@faramir.informatik.uni-oldenburg.de" or "reimann@uniol.uucp"