fopen

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • Richard Bos
    Guest replied
    Re: fopen

    "Serve Lau" <nihao@qinqin.c omwrote:
    "CBFalconer " <cbfalconer@yah oo.comschreef in bericht
    news:485AD88B.C F3F7D84@yahoo.c om...
    Please show me my posts that justifies this general statement. Also
    please dont criticize my puntuation, it makes me feel VERY bad.
    ^^
    Alright, I'll ignore punctuation. :-) As for general statements,
    the quotation above will do.
    >
    get out more
    Leer je talen correct schrijven, dwaze Belg. Je bent een belediging voor
    het Nederlandse taalgebied.

    Richard

    Leave a comment:


  • Serve Lau
    Guest replied
    Re: fopen


    "CBFalconer " <cbfalconer@yah oo.comschreef in bericht
    news:485AD88B.C F3F7D84@yahoo.c om...
    >Please show me my posts that justifies this general statement. Also
    >please dont criticize my puntuation, it makes me feel VERY bad.
    ^^
    Alright, I'll ignore punctuation. :-) As for general statements,
    the quotation above will do.
    get out more

    Leave a comment:


  • CBFalconer
    Guest replied
    Re: fopen

    Serve Lau wrote:
    "CBFalconer " <cbfalconer@yah oo.comschreef:
    >Serve Lau wrote:
    >>"Bill Cunningham" <nospam@nspam.c omschreef in bericht
    >>>
    >>>I have a question about fopen. I want to append text to a text
    >>>file already written. I think this is what I need to do. If I am
    >>>correct fopen's second parameter takes only 2 letters. I am using
    >>>wt. To append text would I need another call to fopen if my text
    >>>file isn't already existing consisting of wa or a+ ?
    >>>
    >>read your favorite C book and try it out, its in there no matter
    >>if its a good or bad book ^^
    > ^^
    >You appear to devote your time to telling people not to ask
    >questions, using incorrect punctuation.
    >
    Please show me my posts that justifies this general statement. Also
    please dont criticize my puntuation, it makes me feel VERY bad.
    ^^
    Alright, I'll ignore punctuation. :-) As for general statements,
    the quotation above will do.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home .att.net>
    Try the download section.


    ** Posted from http://www.teranews.com **

    Leave a comment:


  • Serve Lau
    Guest replied
    Re: fopen


    "CBFalconer " <cbfalconer@yah oo.comschreef in bericht
    news:4856EAF9.A 326DC80@yahoo.c om...
    Serve Lau wrote:
    >"Bill Cunningham" <nospam@nspam.c omschreef in bericht
    >>
    >>I have a question about fopen. I want to append text to a text
    >>file already written. I think this is what I need to do. If I am
    >>correct fopen's second parameter takes only 2 letters. I am using
    >>wt. To append text would I need another call to fopen if my text
    >>file isn't already existing consisting of wa or a+ ?
    >>
    >read your favorite C book and try it out, its in there no matter
    >if its a good or bad book
    >
    You appear to devote your time to telling people not to ask
    questions, using incorrect punctuation.
    Please show me my posts that justifies this general statement. Also please
    dont criticize my puntuation, it makes me feel VERY bad.

    Leave a comment:


  • CBFalconer
    Guest replied
    Re: fopen

    Serve Lau wrote:
    "Bill Cunningham" <nospam@nspam.c omschreef in bericht
    >
    >I have a question about fopen. I want to append text to a text
    >file already written. I think this is what I need to do. If I am
    >correct fopen's second parameter takes only 2 letters. I am using
    >wt. To append text would I need another call to fopen if my text
    >file isn't already existing consisting of wa or a+ ?
    >
    read your favorite C book and try it out, its in there no matter
    if its a good or bad book
    You appear to devote your time to telling people not to ask
    questions, using incorrect punctuation.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home .att.net>
    Try the download section.


    ** Posted from http://www.teranews.com **

    Leave a comment:


  • CBFalconer
    Guest replied
    Re: fopen

    Bill Cunningham wrote:
    "Richard Heathfield" <rjh@see.sig.in validwrote:
    >
    ><3d38f60e_3@co rp.newsgroups.c om(posted on 20 July 2002) you
    >wrote:
    >>
    > "This little K&R2 book is giving me the devil of a time."
    >>
    >It is not unreasonable to deduce from that statement that you
    >have had a copy of K&R2 since at least 2002.
    >>
    >Despite your claim, K&R2 *does* document the return value
    >semantics for fopen, freopen, fflush, fclose, fprintf, fscanf,
    >fgetc, fgets, fputc, fputs, fread, fwrite, fseek, ftell,
    >fgetpos, and fsetpos - on pp242-248.
    >>
    >>What about ftell and fseek do they return -1 or non zero
    >>when successful ?
    >>
    >Read the book.
    >
    I may have to break it out. I have a little pocket reference
    I've leafed though. Couldn't find return values.
    You should never have hidden it. It answers virtually every
    question you have asked here.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home .att.net>
    Try the download section.

    ** Posted from http://www.teranews.com **

    Leave a comment:


  • Chris Thomasson
    Guest replied
    Re: fopen

    "Bill Cunningham" <nospam@nspam.c omwrote in message
    news:5iG5k.6640 4$bs3.8292@trnd dc07...
    >
    "Richard Heathfield" <rjh@see.sig.in validwrote in message
    news:g8KdnYe2zO ZlvMrVnZ2dneKdn ZydnZ2d@bt.com. ..
    >Bill Cunningham said:
    >>
    >>>
    >>"Bill Cunningham" <nospam@nspam.c omwrote in message
    >>news:66D5k.20 948$3j2.17956@t rnddc03...
    >>>>
    >>>"Serve Lau" <nihao@qinqin.c omwrote in message
    >>>news:e8de8$4 856df32$541fc2e c$30325@cache5. tilbu1.nb.home. nl...
    >>>
    >> You know my book doesn't give return values for these functions for
    >>error checking.
    >>
    >In message <3d38f60e_3@cor p.newsgroups.co m(posted on 20 July 2002) you
    >wrote:
    >>
    > "This little K&R2 book is giving me the devil of a time."
    >>
    >It is not unreasonable to deduce from that statement that you have had a
    >copy of K&R2 since at least 2002.
    >>
    >Despite your claim, K&R2 *does* document the return value semantics for
    >fopen, freopen, fflush, fclose, fprintf, fscanf, fgetc, fgets, fputc,
    >fputs, fread, fwrite, fseek, ftell, fgetpos, and fsetpos - on pp242-248.
    >>
    >>What about ftell and fseek do they return -1 or non zero
    >>when successful ?
    >>
    >Read the book.
    >>
    I may have to break it out. I have a little pocket reference I've
    leafed though. Couldn't find return values. Well I'll get them.








































    ect...







    is you friend!

    Leave a comment:


  • rahul
    Guest replied
    Re: fopen

    On Jun 17, 8:35 am, "Bill Cunningham" <nos...@nspam.c omwrote:
    "Richard Heathfield" <r...@see.sig.i nvalidwrote in message
    >
    news:g8KdnYe2zO ZlvMrVnZ2dneKdn ZydnZ2d@bt.com. ..
    >
    Bill Cunningham said:
    >
    "Bill Cunningham" <nos...@nspam.c omwrote in message
    >news:66D5k.209 48$3j2.17956@tr nddc03...
    >
    >"Serve Lau" <ni...@qinqin.c omwrote in message
    >>news:e8de8$48 56df32$541fc2ec $30325@cache5.t ilbu1.nb.home.n l...
    >
    You know my book doesn't give return values for these functions for
    error checking.
    >
    In message <3d38f60...@cor p.newsgroups.co m(posted on 20 July 2002) you
    wrote:
    >
    "This little K&R2 book is giving me the devil of a time."
    >
    It is not unreasonable to deduce from that statement that you have had a
    copy of K&R2 since at least 2002.
    >
    Despite your claim, K&R2 *does* document the return value semantics for
    fopen, freopen, fflush, fclose, fprintf, fscanf, fgetc, fgets, fputc,
    fputs, fread, fwrite, fseek, ftell, fgetpos, and fsetpos - on pp242-248.
    >
    What about ftell and fseek do they return -1 or non zero
    when successful ?
    >
    Read the book.
    >
    I may have to break it out. I have a little pocket reference I've leafed
    though. Couldn't find return values. Well I'll get them.
    >
    Bill
    /* Code not compiled */
    #include <stdio.h>
    #include <stdlib.h>

    int
    main(int argc, char *argv[]) {
    double x;
    FILE *fp;
    x = strtod(argv[1], NULL);
    fp = fopen("foo", "a+");
    fprintf(fp, "%.2f", x);
    fclose(fp);
    return 0;
    }

    Probably this is what you want to do. The mode "a+" means open for
    appending and reading as well. Its not required if you just wish to
    append to the file.
    Return type for ftell is long. fseek returns int ( -1 on error, 0
    otherwise ). If you are on linux/unix box, use the man pages. If you
    are on a windows machine and using Visual Studio, you can use MSDN.
    Its better to have the documentation handy.

    Leave a comment:


  • Bill Cunningham
    Guest replied
    Re: fopen


    "Richard Heathfield" <rjh@see.sig.in validwrote in message
    news:g8KdnYe2zO ZlvMrVnZ2dneKdn ZydnZ2d@bt.com. ..
    Bill Cunningham said:
    >
    >>
    >"Bill Cunningham" <nospam@nspam.c omwrote in message
    >news:66D5k.209 48$3j2.17956@tr nddc03...
    >>>
    >>"Serve Lau" <nihao@qinqin.c omwrote in message
    >>news:e8de8$48 56df32$541fc2ec $30325@cache5.t ilbu1.nb.home.n l...
    >>
    > You know my book doesn't give return values for these functions for
    >error checking.
    >
    In message <3d38f60e_3@cor p.newsgroups.co m(posted on 20 July 2002) you
    wrote:
    >
    "This little K&R2 book is giving me the devil of a time."
    >
    It is not unreasonable to deduce from that statement that you have had a
    copy of K&R2 since at least 2002.
    >
    Despite your claim, K&R2 *does* document the return value semantics for
    fopen, freopen, fflush, fclose, fprintf, fscanf, fgetc, fgets, fputc,
    fputs, fread, fwrite, fseek, ftell, fgetpos, and fsetpos - on pp242-248.
    >
    >What about ftell and fseek do they return -1 or non zero
    >when successful ?
    >
    Read the book.
    >
    I may have to break it out. I have a little pocket reference I've leafed
    though. Couldn't find return values. Well I'll get them.

    Bill


    Leave a comment:


  • Walter Roberson
    Guest replied
    Re: fopen

    In article <%GE5k.40579$lE 3.1104@trnddc05 >,
    Bill Cunningham <nospam@nspam.c omwrote:
    fp = fopen ("data", "wa");
    I said to use "a", not "wa".
    --
    "MAMA: Oh--So now it's life. Money is life. Once upon a time freedom
    used to be life--now it's money. I guess the world really do change.
    WALTER: No--it was always money, Mama. We just didn't know about it."
    -- Lorraine Hansberry

    Leave a comment:


  • Richard
    Guest replied
    Re: fopen

    "Bill Cunningham" <nospam@nspam.c omwrites:
    "Walter Roberson" <roberson@ibd.n rc-cnrc.gc.cawrote in message
    news:g36kmr$l0s $1@canopus.cc.u manitoba.ca...
    >
    >The standard does not define the meaning of 't', only of 'b' (binary).
    >Text is assumed if binary is not specified.
    [snip]
    >
    I heard something about Microsoft and the 't'. If it isn't standard why use
    it. What does M$ have to do with this anyway? I just won't use it anymore. I
    will work with the functions you mentioned thanks very much.
    >
    Bill
    Alright, give it up Kenny. It's not funny anymore :-)

    Leave a comment:


  • Richard
    Guest replied
    Re: fopen

    "Bill Cunningham" <nospam@nspam.c omwrites:
    I have a question about fopen. I want to append text to a text file
    already written. I think this is what I need to do. If I am correct fopen's
    second parameter takes only 2 letters. I am using wt. To append text would I
    need another call to fopen if my text file isn't already existing consisting
    of wa or a+ ? How can I check if an existing text file exists that has been
    created before ?
    >
    Bill
    Try reading the man page Bill. I hear it helps.

    Leave a comment:


  • Richard Heathfield
    Guest replied
    Re: fopen

    Bill Cunningham said:
    >
    "Richard Heathfield" <rjh@see.sig.in validwrote in message
    news:_uOdnf1Ika L5gsrVnZ2dneKdn ZydnZ2d@bt.com. ..
    >If he really were in your killfile, you would not have seen his article.
    >>
    I use OE. There's no killfile there.
    Then he can't be in one, can he?
    I just don't read posts from certain persons.
    If that were true, you would not have read his article, so there would have
    been no cause to respond to it.

    --
    Richard Heathfield <http://www.cpax.org.uk >
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999

    Leave a comment:


  • Richard Heathfield
    Guest replied
    Re: fopen

    Bill Cunningham said:
    >
    "Bill Cunningham" <nospam@nspam.c omwrote in message
    news:66D5k.2094 8$3j2.17956@trn ddc03...
    >>
    >"Serve Lau" <nihao@qinqin.c omwrote in message
    >news:e8de8$485 6df32$541fc2ec$ 30325@cache5.ti lbu1.nb.home.nl ...
    >
    You know my book doesn't give return values for these functions for
    error checking.
    In message <3d38f60e_3@cor p.newsgroups.co m(posted on 20 July 2002) you
    wrote:

    "This little K&R2 book is giving me the devil of a time."

    It is not unreasonable to deduce from that statement that you have had a
    copy of K&R2 since at least 2002.

    Despite your claim, K&R2 *does* document the return value semantics for
    fopen, freopen, fflush, fclose, fprintf, fscanf, fgetc, fgets, fputc,
    fputs, fread, fwrite, fseek, ftell, fgetpos, and fsetpos - on pp242-248.
    What about ftell and fseek do they return -1 or non zero
    when successful ?
    Read the book.

    --
    Richard Heathfield <http://www.cpax.org.uk >
    Email: -http://www. +rjh@
    Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
    "Usenet is a strange place" - dmr 29 July 1999

    Leave a comment:


  • Bill Cunningham
    Guest replied
    Re: fopen


    "Richard Heathfield" <rjh@see.sig.in validwrote in message
    news:_uOdnf1Ika L5gsrVnZ2dneKdn ZydnZ2d@bt.com. ..
    If he really were in your killfile, you would not have seen his article.
    >
    I use OE. There's no killfile there. I just don't read posts from certain
    persons. I know agent has a killfile. There comes a time to not read some
    posts. A "killfile".

    Bill


    Leave a comment:

Working...