Alternative to fstream

This is a discussion on Alternative to fstream within the Windows Programming forums, part of the Platform Specific Boards category; I need an alternative to fstream for file input and output. When I use fstream, it bloats my program and ...

  1. #1
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136

    Alternative to fstream

    I need an alternative to fstream for file input and output. When I use fstream, it bloats my program and increases the size by 30 kb. I was wondering if I should use C style file i/o or WinAPI i/o. Any input would be appreciated.

  2. #2
    Has a Masters in B.S.
    Join Date
    Aug 2001
    Posts
    2,267
    i would go normal c style or go low level c style,

    normal.. the way it should be done

    in stdio.h

    fopen()
    fread()
    fwrite()
    fgets()
    fputs()
    fprintf()
    fscanf()
    fclose()
    fcloseall()

    us fread() and fwrite() they are the most flexible and reliable

    low level, a little more difficult... agai nthe way it should be done

    the header unfortunatly vaires

    MSVC is io.h

    open()
    close()
    read()
    write()
    ADVISORY: This users posts are rated CP-MA, for Mature Audiences only.

  3. #3
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Thanks, I think I will go normal. Low-Level definately isn't needed; I only need to store info.

  4. #4
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    ..or better, use the actual system calls that the std libs call....

    CreateFile()
    ReadFile()
    WriteFile()
    OpenFile()

    You only need the windows.h and as these reside in Kernel32.dll - less bloat, but a little more work than fstreams.........

    I am pretty used to these now ..... they are more or less all I use....

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fstream. I/O
    By kevinawad in forum C++ Programming
    Replies: 2
    Last Post: 07-07-2008, 09:19 AM
  2. using fstream
    By swgh in forum C++ Programming
    Replies: 1
    Last Post: 02-11-2006, 03:53 AM
  3. ARGH! fstream errors
    By OttoDestruct in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2004, 10:37 PM
  4. Are fstream and ofstream incompatible?
    By johnnyd in forum C++ Programming
    Replies: 5
    Last Post: 03-19-2003, 11:21 AM
  5. Problems with fstreams.
    By mosdef in forum C++ Programming
    Replies: 7
    Last Post: 06-19-2002, 03:36 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21