Jump to content

View more

Image of the Day

The night is still, but the invasion brings chaos. #screenshotsaturday #hanako #indiegame #gameart #ue4 #samurai https://t.co/cgILXuokoS
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Storing a string in a struct

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
3 replies to this topic

#1 theBegger   Members   

107
Like
0Likes
Like

Posted 12 May 2014 - 12:16 AM

I'm trying to store a string in a struct. Do I need different call names for the string and the string when it's in the struct? What is the correct syntax for something like this?



#2 BitMaster   Members   

8647
Like
0Likes
Like

Posted 12 May 2014 - 12:46 AM

I have no clue what you are asking. What language are you talking about? What do you mean by 'call name'?

#3 Vortez   Members   

2710
Like
2Likes
Like

Posted 12 May 2014 - 12:46 AM

Are you talking about a c-string (char array) or a c++ string (STL), those are totally different thing. But anyway, you write them pretty much the same way as without a struct:

 

struct SomeStruct {

    char Buffer[256];

};

 

or

 

struct SomeStruct {

    std::string s;

};


Edited by Vortez, 12 May 2014 - 12:46 AM.


#4 theBegger   Members   

107
Like
0Likes
Like

Posted 12 May 2014 - 01:17 AM

Sorry BitMaster, I thought that since I tagged the language I was covering the bases, but I can elaborate next time!

 

Thanks vortez that is extremely helpful :)






Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.