Jump to content

  • Log In with Google      Sign In   
  • Create Account

Storing a string in a struct


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   -  Reputation: 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?



Sponsor:

#2 BitMaster   Crossbones+   -  Reputation: 4088

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   Crossbones+   -  Reputation: 2698

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   -  Reputation: 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.



PARTNERS