********************** EBSTREAM.TXT **************************************** ***************** Prof. Dr. B. Bartning ************************************ ----------------------------------------------------------------------------- Notes about problems with German special sounds ----------------------------------------------- The following notes are important only for exercises in which German special sounds are to be handled with input and output. In the exercise texts, this is indicated. According to the remarks in the lecture, you can expect that there are no problems with German special sounds in C++, too, as long as you do not use the member function get() WITHOUT any parameter. However, there are problems if you alternate between Windows ( e. g. editor MS Visual C++, also Borland) and DOS (e. g. execution window with standard applications), because there are different codes in Windows and DOS for the German special sounds. Thus, this is NOT a problem of C++, it is a problem of the operating systems. Here are two possible remedies: REMEDY 1 -------- Use the stream objects bcin and bcout instead of the stream objects cin and cout.The code belonging to them is written in the files BSTREAM.H and BSTREAM.CPP. These objects automatically perform the necessary conversions into the WIN or DOS codes so that the problems do not seem to exist. (Use of manipulators WITH parameters see notes below.) If it does not work: please inform me (Bartning). Note: you need not understand the program text of the two files BSTREAM.H and BSTREAM.CPP! In any case (if using the Microsoft IDE), please alter the include lines in the following way: - append ".h" to header names, - comment out "Use namespace std;". Detail see lecture notes ch. 0.3. These BSTREAM files are not compatible with the new headers (without ".h"). If you have to compile only ONE file: most easily, include the file BSTREAM.CPP at the beginning of your program file (this automatically includes the header file): #include "bstream.cpp" If you have SEVERAL program files: include only the header file into each program file in which you need the new stream objects: #include "bstream.h" additionally include the file BSTREAM.CPP into the project. REMEDY 2 -------- If you use the IDE (Integrated Development Environment) of MS Visual C++ (or Borland, too): - Use a separate DOS window with the DOS editor program (command "EDIT" in a DOS window), update the program text IN THIS WINDOW with umlauts or other characters, store the program text (DO NOT forget, you need not leave EDIT). - Activate the IDE MS Visual C++, confirm to load the changed source text, compile and link as usual. - The program is to be executed in a DOS window, the German special sounds are recognized correctly. - To update the source text: activate the EDIT window again. PLEASE, IN ANY CASE, DO NOT look up the codes for the German special sounds in a code table. In the source code, the character Shift-A-Umlaut is represented with 'Ä' - and NOT 142 (DOS) or 196 (Windows), additionally you would have further problems because these characters have negative values with the used compilers (type char is signed, mostly)! Use of BSTREAM.*, using manipulators WITH parameter(s): ------------------------------------------------------- - Manipulators WITHOUT parameter (e. g. endl, hex): no problems. - Since the implementation of manipulators WITH parameter(s) is compiler specific, perhaps the code conversion does not work when using these manipulators. For Microsoft compiler, in BSTREAM.CPP, there are manipulator implementations tested and working with the versions 4.0, 5.0, 6.0 (BSTREAM.H: #ifdef _MSC_VER ... #endif) Remedy for other compilers: Either: use member functions instead of manipulators Or: each time a new call with operator <<, i. e. instead of: bcout << a << b; the following: bcout << a; bcout << b; (with "a" manipulator WITH paramater, "b" character/string) Important remark about using these stream objects as parameters --------------------------------------------------------------- Since the streams are not polymorph, i. e. since the member functions of the streams are not virtual, it is not possible to pass the stream objects bcin and bcout as parameters of the base class types istream or ostream. Cp. also the remark in (11.41 Remark3). *****************************************************************************