|
From: Michael C. <jd...@ho...> - 2001-09-04 07:48:59
|
Hi,
Did you get the fprintf to work because I am still having trouble.
I have also tried it at work on a HPUX 10.20 aCC compiler but neither
version works for reading from a file.
fprintf (stdout, "%s", fhandle);
fprintf (stdout, "%s", *fhandle);
Note, the second version works on the Dev C++ compiler but reads the first
line only.
And yes, I agree there are many ways to move the file pointer and that
seeking to the end of a string is bad strategy. I was just trying to get the
thing to read from a file using fprintf().
Michael
>From: "Ioannis Vranos" <no...@ya...>
>To: "Dev-C++" <dev...@li...>
>Subject: RE: [Dev-C++] how to use strings
>Date: Tue, 4 Sep 2001 02:13:53 +0200
>
> > -----Original Message-----
> > From: dev...@li...
> > [mailto:dev...@li...] On Behalf
> > Of Michael C
> > Sent: Monday, September 03, 2001 10:37 PM
> > To: dev...@li...
> > Subject: Re: [Dev-C++] how to use strings
> > 3) fprintf() and fscanf() do not move the file position and I
> > can't remember how to do this. So another call to fprintf()
>
>Of course they do. There are thousands of many ways to move the file
>position, fseek(), fread(), ....
>
> > will not read the stringified number on the next line. I
> > thought I could use:
> > 'fseek (fhandle, len, SEEK_CUR);' where len is the
> > returned value from a successful call to fprintf()
>
>The strategy is a mistake.
>
> > However, this doesn't work. Instead I prefer to use:
> >
> > int c;
> > while ((c = fgetc (fhandle)) != EOF)
> > {
> > fputc (c, stdout);
> > }
> >
>
>This works too.
>
> > Any comments?
> >
> > Hope this helps.
> >
> > Michael
>
>
>Ioannis
>
>* Ioannis Vranos
>* Programming pages: http://www.noicys.f2s.com
>* Alternative URL: http://run.to/noicys
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
|