Thread: Alternative to fstream

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

    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,263
    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,138
    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,793
    ..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, 04: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, 12:21 PM
  5. Problems with fstreams.
    By mosdef in forum C++ Programming
    Replies: 7
    Last Post: 06-19-2002, 03:36 PM