[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: wait_for_file ?? [GL2PS error: Bad file pointer]
From: |
Ben Abbott |
Subject: |
Re: wait_for_file ?? [GL2PS error: Bad file pointer] |
Date: |
Mon, 13 Sep 2010 18:54:19 -0400 |
On Sep 12, 2010, at 12:20 AM, Shai Ayal wrote:
> On Sun, Sep 12, 2010 at 2:42 AM, Michael D Godfrey
> <address@hidden> wrote:
>> On 09/11/2010 03:00 PM, Ben Abbott wrote:
>>
>> to use, pass the fid as a string to drawnow:
>>> e.g. to keep current functionality, use
>>> fid = fopen ("test.eps","wb");
>>> drawnow ("eps" , sprintf ("%d" , fid));
>>>
>>> and to pipe it into another program, use popen:
>>> fid = popen ("cat > test.eps" , "w")
>>> drawnow ("eps" , sprintf ("%d" , fid));
>>>
>>> Shai
>>
>> I'm seeing a repeatable error/warning when printing to a file.
>>
>> The code below ...
>>
>> Ben,
>>
>> I see what Shai said above, but I could not find where he does an
>> fclose in drawnow(). By the way, it is always good practice to follow
>> fclose(fid); with fid =0; . fclose() does not change the fid, and in fact
>> you can still do IO using that fid, but which file it points to will change
>> as more fopens are done! Another benefit of C and its IO libraries.
>>
> fclose is in glps-renderer::draw which IMHO is the only place it
> should be since it's the only place guaranteed to be after the file
> has been written to.
>
> Shai
Shai,
I'm unable to get writing to files to work with GL2PS. I continue to get the
error, "GL2PS error: Bad file pointer".
However, I did find an approach that eliminates all errors with pipes. I don't
understand why this works for gl2ps, but when I add *both* the waitpid() and
pclose(pid), then I get no errors.
pid = popen ("cat > test.eps", "w");
drawnow ("eps" , sprintf ("%d" , pid));
waitpid (pid);
pclose (pid);
I have a few more changes to make to the printing routines. With some luck
I'll post another proposed changeset this evening.
Ben
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], (continued)
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], Marco Atzeri, 2010/09/22
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], bpabbott, 2010/09/22
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], Marco Atzeri, 2010/09/22
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], bpabbott, 2010/09/22
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], Marco Atzeri, 2010/09/22
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], Ben Abbott, 2010/09/23
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], Marco Atzeri, 2010/09/23
- Re: wait_for_file ?? [print via pipes - help testing on Windows?], bpabbott, 2010/09/23
- Re: wait_for_file ?? [GL2PS error: Bad file pointer],
Ben Abbott <=
- Re: wait_for_file ?? [GL2PS error: Bad file pointer], Michael D Godfrey, 2010/09/13
- Re: wait_for_file ?? [GL2PS error: Bad file pointer], Shai Ayal, 2010/09/14
- Re: wait_for_file ?? [GL2PS error: Bad file pointer], Michael D Godfrey, 2010/09/14
- Re: wait_for_file ??, Ben Abbott, 2010/09/09
- Re: wait_for_file ??, Ben Abbott, 2010/09/04
- Re: wait_for_file ??, Ben Abbott, 2010/09/06
- Re: wait_for_file ??, Michael D Godfrey, 2010/09/06
- Re: wait_for_file ??, Ben Abbott, 2010/09/06
- Re: wait_for_file ??, Ben Abbott, 2010/09/08
- Re: wait_for_file ??, Ben Abbott, 2010/09/05