Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / General c++ question

Author
Message
tripleF
18
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 20th Jul 2006 15:51
How do i initialize a string array inside a class? This dosent seem to work and iv tryed other ways to
tripleF
18
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 20th Jul 2006 19:31
I cant even get this to work.But it was in an example in a c++ tutorial

I get these errors
: error C2371: 'name' : redefinition; different basic types
: error C2440: 'initializing' : cannot convert from 'const char [5]' to 'int'
: error C2501: 'name' : missing storage-class or type specifiers
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 20th Jul 2006 22:16
In answer to your first post, you can't. There is no automatic conversion of an array of char* to an array of strings. I don't think that there is any way to do it that looks good, except this way:


The answer to your second post is that your code is wrong ... or the tutorial is wrong (find a decent one - 'Thinking in C++' is a free book available off the net). You can only assign a char* to a string as a part of the construction, or within a function.

So, either this:


or this:



For free Plug-ins and source code http://www.matrix1.demon.co.uk
tripleF
18
Years of Service
User Offline
Joined: 4th Jun 2006
Location:
Posted: 21st Jul 2006 01:17
thnx for answer downloading the book now

Login to post a reply

Server time is: 2024-11-19 06:44:29
Your offset time is: 2024-11-19 06:44:29