This topic is now archived and is closed to further replies.

Array of words - Trouble!

This topic is 6115 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am trying to create a array of words that I can use as texture names and locations as done in Lesson 6 with NeHe. But all that I know how to do is an array of characters. So lets say that I have the following code: char *FileName; FileName = "Data/Crate.bmp"; And Lets say that I have lots of filenames, lets say 10 in all. And lets say that I want to put each filename in array so that it is easy to access later. How would I go about doing that? Can anyone help? Any help would be appreciated! Thanks! John William Blair

Share this post

Link to post
Share on other sites
if you know the max number at compile time, use a static array like this:
char file_names[NUM_WORDS][MAX_CHAR_PER_WORD];

char temp[MAX...]
for(int i=0;i{

but i prefer the STL:

std::vector file_names;
then it can expand dynamically

Share this post

Link to post
Share on other sites