Straight C file stream.

This is a discussion on Straight C file stream. within the C Programming forums, part of the General Programming Boards category; I know you use fstream.h for files in C++, but what do you use in straight C? I'm just curious....

  1. #1
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913

    Straight C file stream.

    I know you use fstream.h for files in C++, but what do you use in straight C? I'm just curious.

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    fread/fwrite/fget*/fput*/fopen/fclose

    A whole bunch of 'f'-ing function. :P

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User Nutshell's Avatar
    Join Date
    Jan 2002
    Posts
    1,020
    They're all in stdio.h

  4. #4
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    Ah - thanks. And just one more question - does C offer anyting C++ doesn't? like, would every C program compile under a C++ compiler?

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    > would every C program compile under a C++ compiler?

    No. Due to the way the C++ compiler works (C++ being stricter with error checking) it would likely, depending on the program, require some tweaking. (For example, C++ isn't fond of void pointers.)

    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    752
    But other than such conventions (as far as I know, the void * issue is the only point where the two languages have issues), C can't do anything C++ can't.
    Callou collei we'll code the way
    Of prime numbers and pings!

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,834
    This explains why one is neither a sub-set or a super-set of the other.

    http://david.tribble.com/text/cdiffs.htm

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    108

    Thumbs up

    Thank you Salem for the link , that is just what I have been looking for.
    rwalt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 08:54 AM
  2. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 04:53 AM
  3. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 01:36 PM
  4. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 04:39 AM
  5. Replies: 9
    Last Post: 07-01-2002, 08:50 AM

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