View Poll Results: Which I/O calls do you use the most?

Voters
20. You may not vote on this poll
  • "C" library calls (eg. fopen)

    8 40.00%
  • "C++" library calls (eg. streams)

    12 60.00%
  • "OS" library calls (eg. CreateFileA)

    1 5.00%
Multiple Choice Poll.

Which I/O calls do you use the most?

This is a discussion on Which I/O calls do you use the most? within the Tech Board forums, part of the Community Boards category; Just wondering which I/O calls you use the most - the C library calls (fopen, fread, fgets, etc), the C++ ...

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    245

    Which I/O calls do you use the most?

    Just wondering which I/O calls you use the most - the C library calls (fopen, fread, fgets, etc), the C++ library calls (streams), or the OS-specific calls (CreateFileA etc on Windows for example)

  2. #2
    Registered User
    Join Date
    Jun 2003
    Posts
    245
    Pfft.. I wanted to see whether C++ users preferred the standard C i/o call or the OS ones instead of the standard C++ calls, but oh well, never mind...

    Personally however, I think the C++ I/O library sucks for anything but the most basic of operations. I prefer the OS calls myself.

  3. #3
    RoD
    RoD is offline
    Redundantly Redundant RoD's Avatar
    Join Date
    Sep 2002
    Location
    Missouri
    Posts
    6,331
    option 2, please.

  4. #4
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    I'm an avid user of C++, but I prefer C's I/O routines. C++ routines can be slow, and they are overcomplicated solutions to simple problems. cout<< and cin>> are the only ones I ever use, and I rarely use them. printf() for me.

    Fstream is terrible, IMHO. I've had so many problems trying to work it to do what I want it to do. I've heard that C's file i/o is faster as well, but I don't notice a speed difference between cstdio and fstream.

  5. #5
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    i use the c++ stuff... idk... it just seems easier to me... probably because I learned them first...
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  6. #6
    Registered User
    Join Date
    Nov 2002
    Posts
    126
    I haven't had a whole lot of experience with C-style I/O, but C++ streams work just fine for me.

    C++ routines can be slow, and they are overcomplicated solutions to simple problems
    I would agree that C++ streams are complicated, but not overcomplicated. Honestly, all I/O operations are slow, comparitively. If I wanted to make a streamline I/O routine where every millisecond was precious, I would probably use C-style I/O. But for normal I/O, I'll take the stream object.

  7. #7
    ¡Amo fútbol!
    Join Date
    Dec 2001
    Posts
    2,136
    Originally posted by PorkyChop
    If I wanted to make a streamline I/O routine where every millisecond was precious, I would probably use C-style I/O.
    I'd use the OS specific calls as they are the fastest.

  8. #8
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    For simple things I use cout but if I want anything formatted, I tend to use printf(), acheiving the same results with manipulators is not difficult, but takes up so much space. That said, I mostly program Windows, so neither is of any direct use, but then I tend to use sprintf() when building strings.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  9. #9
    Senior Member joshdick's Avatar
    Join Date
    Nov 2002
    Location
    Phildelphia, PA
    Posts
    1,146
    OS I/O is not portable. C++ I/O is much easier to use than C I/O. Is one slower than the other? Probably. But keep in mind that nowadays software is more expensive and valuable than hardware. It's a better use of resources to write a program that's easy to write than one that worries about some miniscule speed optimization. The fact remains that the user will not be able to distinguish the difference, however one is more difficult to code than the other.
    FAQ

    "The computer programmer is a creator of universes for which he alone is responsible. Universes of virtually unlimited complexity can be created in the form of computer programs." -- Joseph Weizenbaum.

    "If you cannot grok the overall structure of a program while taking a shower, you are not ready to code it." -- Richard Pattis.

  10. #10
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    OS calls are not portable, better would be to use POSIX calls instead, or standard C/C++ calls. Depending on the type of application I use POSIX calls or standard C/C++ calls.

  11. #11
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789
    As most of the coding I do is very windows oriented....I tend to use CreateFile/ReadFile/WriteFile more than anything else

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 26
    Last Post: 07-05-2010, 10:43 AM
  2. Replies: 11
    Last Post: 11-26-2008, 10:43 PM
  3. asynchronized I/O == multiplexing I/O?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 07-24-2006, 10:06 AM
  4. why page based I/O can improve performance?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 06-12-2006, 07:42 AM
  5. Overlapped I/O and Completion Port :: Winsock
    By kuphryn in forum Windows Programming
    Replies: 0
    Last Post: 10-30-2002, 04:14 PM

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