Jump to content

  • Log In with Google      Sign In   
  • Create Account

#Actualkunos

Posted 08 October 2013 - 12:38 AM

Thanks. It worksbiggrin.png I just used strcpy.  For future reference what was it that made all the objects in the array set to the same value?

 

the lesson to bring home here is: if you are working with C++, USE C++ and forget about C.

The code you have posted is bound to fail in subtle ways (as you have discovered). Unless you have very good reasons not to, ALWAYS use std::string instead of char* and ALWAYS use std::vector instead of old style arrays... the code will end up being easier to read for you, for people trying to help you, for people you work with and it will also be safer.


#1kunos

Posted 08 October 2013 - 12:37 AM

Thanks. It worksbiggrin.png I just used strcpy.  For future reference what was it that made all the objects in the array set to the same value?

 

the lesson to bring home here is: if you are working with C++, USE C++ and forget about C.

The code you have posted is bound to fail in subtle ways (as you have discovered). Unless you have very good reasons not to, ALWAYS use std::string instead of char* and ALWAYS use std::vector instead of old style arrays... the code will end up being easier to read for you, for the people trying to help you, and for the people you work with and it will also be safer.


PARTNERS