RE: [Dev-C++] very strange error & print to printer
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Todd G. <pi...@ea...> - 2004-07-31 13:25:52
|
> -----Original Message----- > From: dev...@li... < snip > > Notice the second line that should be #include <iostream.h> < snip > See the book Thinking in C++, 2nd ed. Volume 1 ©2000 by Bruce Eckel This is a FREE download from http://www.mindview.net/. Do not get volume 2 of this book. It is way too complicated for beginning. ----------------------------------------------------------------------- Standard C++ include format As C++ evolved, different compiler vendors chose different extensions for file names. In addition, various operating systems have different restrictions on file names, in particular on name length. These issues caused source code portability problems. To smooth over these rough edges, the standard uses a format that allows file names longer than the notorious eight characters and eliminates the extension. For example, instead of the old style of including iostream.h, which looks like this: #include <iostream.h> you can now write: #include <iostream> The translator can implement the include statements in a way that suits the needs of that particular compiler and operating system, if necessary truncating the name and adding an extension. Of course, you can also copy the headers given you by your compiler vendor to ones without extensions if you want to use this style before a vendor has provided support for it. The libraries that have been inherited from C are still available with the traditional .h extension. However, you can also use them with the more modern C++ include style by prepending a c before the name. Thus: #include <stdio.h> #include <stdlib.h> become: #include <cstdio> #include <cstdlib> And so on, for all the Standard C headers. This provides a nice distinction to the reader indicating when youre using C versus C++ libraries. The effect of the new include format is not identical to the old: using the .h gives you the older, non-template version, and omitting the .h gives you the new templatized version. Youll usually have problems if you try to intermix the two forms in a single program. |