Path: utzoo!attcan!uunet!mcvax!ukc!dcl-cs!nott-cs!psxgas From: psxgas@cs.nott.ac.uk (Alan Shepherd) Newsgroups: comp.lang.c++ Subject: OOPS library Strings and char* Message-ID: <2859@robin.cs.nott.ac.uk> Date: 1 Aug 88 12:57:39 GMT Organization: Computer Science, Nottingham Univ., UK. Lines: 23 Does anyone know how to use the OOPS Strings in standard C++ routines which take char* parameters eg. filebuf.open(char*, {input,output}) ? The manual says that the operator const char*() should do the trick, but this has been commented out of the code and marked 'cfront bug'. The replacement, operator constCharPtTy() doesn't seem to work either. Normal casting i.e. filebuf.open((char*) &String_name, input) compiles fine, but doesn't perform as expected. For the time being, I've adopted the following solution : filebuf.open((char*) (String_name(0,String_name.length()).ptr()),input); This uses the substring class method ptr() which returns a const char* by converting the string into a substring using the SubString operator()(pos,len) . Thanks for any help, Alan Shepherd