www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

c++ - iostream read & write mising unsigned char* args variant

↑ ↓ ← Jean-Pierre H. Dumas <jeanpierre.dumas freesbee.fr> writes:
C++ 8.34, Win32.

I get an error about istream::read and ostream::write because
there is no variant for unsigned char* (The norm these days)
only for char*.
Sources are big, not modifiable easily.

So I change iostream.h, compile is OK, but
of course I get the undefined message at link time.

So, how can I recompile istream.cpp etc. and put it back in the
standard libs. I have the sources src/ios, but no instruction I can understand
how to make a good compile of them. If I have to use one of the
src/build file : which one ? (just to compile & make my modified libs,
no need to redo the whole thing.)
Apr 27 2003
↑ ↓ → Richard Grant <fractal clark.net> writes:
In article <1104_1051458884 news.digitalmars.com>, Jean-Pierre H. Dumas says...
C++ 8.34, Win32.

I get an error about istream::read and ostream::write because
there is no variant for unsigned char* (The norm these days)
only for char*.

I think the norm these days is to ignore signed and unsigned varients and to use only char or wchar_t. Most compilers treat char as if it had the same attributes as unsigned char.
Sources are big, not modifiable easily.

You can find out how big the job is by doing a grep or search on "unsigned char". If you find a typedef for unsigned char, grep or search on that. If it turns out the problem is not so big, convert all unsigned char references to char. and change your project settings: <menu>/Project/Settings.../<tab>/Build/<listbox>/Compiler/<group>/ char behavior/<checkbox>/unsigned
So I change iostream.h, compile is OK, but
of course I get the undefined message at link time.

If you have stlport compiled and configured, the header is <iostream>. I think that iostream.h is a vendor defined stream library, and most folks are using the standard headers provided by stlport.
So, how can I recompile istream.cpp etc. and put it back in the
standard libs. I have the sources src/ios, but no instruction I can understand
how to make a good compile of them. If I have to use one of the
src/build file : which one ? (just to compile & make my modified libs,
no need to redo the whole thing.)

I suppose you could just define your own write(unsigned char*,int) method in the iostream header on the ostream class and in the definition cast the unsigned char to char, and shunt to the real write method. That might be a way to accomplish what you want without adjusting the application code. Richard
Apr 28 2003