.h (please read)

This is a discussion on .h (please read) within the C++ Programming forums, part of the General Programming Boards category; This post is for those who include <iostream.h>: The new C++ standard (faster & more flexible) does not have a ...

  1. #1
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    .h (please read)

    This post is for those who include <iostream.h>:

    The new C++ standard (faster & more flexible) does not have a header file named iostream.h, nor does it have fstream.h, stdio.h, or any of the other ANSI-standard .h files that are out there.

    after including <iostream> or any of the other new c++ headers you should declare that you are using the std namespace as the following code shows.

    Code:
    PHP Code:
    #include <iostream> //no .h's #include <fstream> using namespace std//see just one new line int main(int argccharargv) {       cout << "Hello World!" << endl;       return 0; } 

    And the old C headers are also converted to the new format like this:

    <stdio.h> is now <cstdio>
    <string.h> is now <cstring>
    <math.h> is now <cmath>
    hopefully by now you get the pattern

    So far the only problem i know is between the string.h (now cstring) and string,
    #include <string> includes the STL string class (very nice, look into this)
    #include <string.h> includes c functions to deal with char-arrays


    This is a little annoyance of mine, someday the .h's may cause more conflicts (as in the case of string.h vs. string) and it's just better to use the updated headers, makes no obvious change. The new headers are on all compilers after 98 i believe.

    Happy Coding!
    (and don't forget that "using namespace std;" line)

  2. #2
    Banned Troll_King's Avatar
    Join Date
    Oct 2001
    Posts
    1,784
    These files are still all their except now the standard states that they are 'deprecated'. This will trigger a warning, and in further versions of the standard they may be entirely ruled out.

  3. #3
    Registered User
    Join Date
    Sep 2001
    Posts
    16

    Thats life...

    I guess that's life then huh? =P

    Oh well, adapt these new changes and all will be well.
    "Where genius ends, madness begins."
    -Estauns

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How can I know the actual bytes read in a file read
    By pliang in forum C++ Programming
    Replies: 1
    Last Post: 06-08-2005, 05:23 PM
  2. What Would You Use To Read User Input?
    By djwicks in forum C Programming
    Replies: 11
    Last Post: 04-05-2005, 04:32 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Read Array pro!!Plz help!!
    By Supra in forum C Programming
    Replies: 2
    Last Post: 03-04-2002, 03:49 PM
  5. Help! Can't read decimal number
    By Unregistered in forum C Programming
    Replies: 2
    Last Post: 09-07-2001, 03:09 AM

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