www.digitalmars.com         C & C++   DMDScript  

c++.dos.32-bits - strings in dos32

reply harito <harito_member pathlink.com> writes:
Hi, i'm new in using dmc, well i'm also new in programming. I've read a lot
tutorials about c++, but it was difficult to compile all the examples included
in those tuts, i tried different compilers, until i found the one and only dmc,
which is great, the programs run fast, and the size of the generated program is
quite good, and most important of all i could finally compile most of the
examples.
I've had only one problem, i can't compile programs that use the string.h
header. I can compile them very easy as win32 console programs, but i can't
compile them as dos32 programs.

For example something like:

//string.cpp
#include <iostream>
#include <string>
using namespace std;

int main () 
{
string str;

cout << "Enter string for testing : ";
cin  >> str;
cout << "\nString is : " << str << endl;

cout << "Enter string for testing "
<< "(d to quit) : ";
while ( cin >> str )
{
cout << endl;
cout << "String is : " << str << endl;
cout << "Enter string for testing "
<< "(d to quit) : ";
}

return 0;
}

I tried to compile that example with a command line like this:

dmc string.cpp -D_STLP_NO_NEW_IOSTREAMS -mx X32.LIB

note: I changed the include line of sc.ini to:
INCLUDE="% P%\..\stlport\stlport";"% P%\..\include";"% P%\..\mfc\include";%INCLUDE%
I've been able to compile many dos32 programs using a command line like the one
i showed above, but any program that uses the string.h header just gives an
error at compile time.
And i can compile the program very easily with the next command line:
dmc string.cpp -D_STLP_NO_NEW_IOSTREAMS
but obviously that creates a win32 console program.

Help!
Just in case that the solution to this enigma is very easy, please remember that
i'm a newbie

And by the way, anytime i compile a dos32 program it runs perfectly well in
win98 and in plain dos, but in win xp it gets very angry and crash. But well...
Dec 06 2005
parent "Walter Bright" <newshound digitalmars.com> writes:
"harito" <harito_member pathlink.com> wrote in message
news:dn5fgt$bnr$1 digitaldaemon.com...
 I've had only one problem, i can't compile programs that use the string.h
 header. I can compile them very easy as win32 console programs, but i
can't
 compile them as dos32 programs.
 For example something like:

 //string.cpp
 #include <iostream>
 #include <string>
<string.h> works fine for dos32, but <string> does not (nor does any other STL header, as STL is not supported for any of the DOS memory models).
 And by the way, anytime i compile a dos32 program it runs perfectly well
in
 win98 and in plain dos, but in win xp it gets very angry and crash. But
well... It'll work with Win32 versions prior to XP. Microsoft changed the DPMI support in XP, breaking DPMI programs.
Dec 09 2005