![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 |
Jack Burton
![]() Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 38
Posts: 5,452
|
Basically, I have a very large program which is *almost* compiling: my only problems are with a line that looks like:
code:std::string input = temp;[/QUOTE]Where temp is a char* . My compiler (Borland 5) tells me "Cannot convert char* to std::string" . I've tried changing the code to be: |
![]() |
![]() |
#2 |
Galvatron
![]() Join Date: June 24, 2002
Location: aa
Posts: 2,101
|
I don't have any c++ experience (not counting nwscript [img]smile.gif[/img] ) but what I often do when I get an error I don't get is use google with the exact code of the error, except for my own constants or declarations.
When I did that with your code I got to this site, under the 'C++ has scary error messages' it looks like a similar error to the one you have. Also the description of the error is good looking at the error message you've got. BTW and this is purely a guess at it cause as I said I don't know much about c++ but those 2 declarations look so similar I doubt they do much different things. Again I don't know about c++ but other languages have convert functions maybe you could try those (if they're in c++ of course), cause right now it looks like you're trying to declare a char* as string (also from the msg) which IMHO doesn't look very if that's possible so easy. Why I think the other piece of code works. It looks like that piece is adding characters to a string, instead of immediately equalling a string to a char*? |
![]() |
![]() |
#3 |
Takhisis Follower
![]() Join Date: April 30, 2001
Location: szép Magyarország (well not right now)
Posts: 5,089
|
Firstly, I don't think you don't need std:: in front of string if you declare "using namespace std;" at the top
code:string input( temp );[/QUOTE]seems like it should work, but according to my reference you need a const char* not a char* as the input. So you could try casting temp to a const char* first, or copying its value to an already declared const char*.
__________________
Too set in his ways to ever relate If he could set that aside, there'd be heaven to pay But weathered and aged, time swept him to grave Love conquers all? Damn, I'd say that area's gray |
![]() |
![]() |
#4 |
Jack Burton
![]() Join Date: November 10, 2001
Location: Bathurst & Orange, in constant flux
Age: 38
Posts: 5,452
|
Time for me to slap myself silly. I've been using a string class which I coded, which publically inherits from std::string . I needed to provide my own constructors, and the assignment operator is virtual. Fixed up those two problems by adding few lines to my class, and it now compiles.
I now need to test this thing very quickly because it's due on Monday. It's a CGI application, and so I need a webserver which can be set up to run a binary file server-side. Meaning, I either need someone who has such a webserver, or I need to figure out how to configure Apache... and then there's the user manual... |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
gesen string | pschub | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 1 | 12-16-2002 03:29 PM |
Gesen string | kods2001 | Baldurs Gate II: Shadows of Amn & Throne of Bhaal | 2 | 03-28-2002 08:23 AM |
Gehsen's Bow String...HELP??? | mastodonian | Baldurs Gate II Archives | 2 | 07-24-2001 04:41 PM |
Bow String? | insomniacau | Baldurs Gate II Archives | 5 | 06-15-2001 07:53 AM |
Bow to go with the string? | Sherpa Doug | Baldurs Gate II Archives | 7 | 03-15-2001 04:39 PM |