Board index » cppbuilder » String.h in Borland?

String.h in Borland?


2004-09-12 10:17:32 PM
cppbuilder17
Hi NG,
i am an Newbie in Borland C++Builder.
I wan't use an precast xml reader module, who's implemented in gnu c/c++
Borland didn't know the standard libraries, e.g. string.h
I wan't to compile the following lines:
#include <string.h>
attrib(char *name, char *val) : name(strdup(name)), val(strdup(val)),
next(0) {
CDEBUG(printf("attrib::attrib(%s, %s)\n", name, val));
}
Borlands error messages is "undefined Function" "strdup".
But strdup is in the standard library of string.h.
Also i don't know, how can i see the libraries-Function in the borland
ide. Usually i am using java (sun4one - ide) and like the good assertion
with in the library-Function and java-doc.
Are there any similar in borland c++
Thanks,
Stefan
 
 

Re:String.h in Borland?

"Stefan Schwärzler" < XXXX@XXXXX.COM >wrote in message news: XXXX@XXXXX.COM ...
Quote
Hi NG,
i am an Newbie in Borland C++Builder.
I wan't use an precast xml reader module, who's implemented in gnu c/c++
Borland didn't know the standard libraries, e.g. string.h
I wan't to compile the following lines:

#include <string.h>
attrib(char *name, char *val) : name(strdup(name)), val(strdup(val)),
next(0) {
CDEBUG(printf("attrib::attrib(%s, %s)\n", name, val));
}

Borlands error messages is "undefined Function" "strdup".
But strdup is in the standard library of string.h.
string.h is not a standard c++ library. cstring contains many of the old
string.h functions and puts them in the standard namespace. I'm not
sure if it includes strdup as I don't generally use char* for strings.
If it does, it probably requires std::strdup(). You can check borland's help
for strdup.
If the above code is yours, it should be fairly easy to convert to
std::string. If not, you may have problems using it in more modern
compilers because of the include.