Andrew Ross wrote: > On Tue, Jul 07, 2009 at 11:06:40AM -0400, Hazen Babcock wrote: >> Any pointers for using this function? When I try: >> fp = (FILE *)plLibOpenPdfstrm(filename); >> >> instead of: >> fp = fopen(filename, "r"); >> >> I get a segmentation fault at my first attempt to read from the file: >> fscanf(fp, "%d\n", &number_colors); >> >> My guess was that this was due to the fact that it opens the file in >> "rb" mode instead of "r" mode, but when I modified it to use "r" mode I >> still got the same segfault. > > Hazen, > > The "b" is ignored on all POSIX implementations of fopen and is retained > only for backwards compatibility. It is (was?) important on windows > last time I tried, which was some years ago. > > If you look at the source, plLibOpenPdfStream returns a PDFstrm pointer > not a FILE pointer. You want to use the plLibOpen wrapper function > instead. This does return a FILE * and should work as you expect, at > least on POSIX / UNIX systems. It might be necessary to modify the > functions to allow opening the file in text mode on windows systems.
Thanks Andrew. It seems to work now (at least on linux). -Hazen ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel