Original Post
Hey everyone, Im having some trouble with a piece of code. Basically I am trying to use strcpy() to set a single entry in an array of strings. However, instead of setting one entry, it seems to set all entries to the same string. :/ Here is where the array is created. The software runs in an environment without dynamic allocation, so its created statically:
//! array of strings (max ENTRY_LENGTH characters per string)
static char _entries[MAX_ENTRIES][ENTRY_LENGTH];
m_bootEntries = (char**) _entries;
//! this option is always the first one
m_bootEntries[0] = "Enter Command Parser";The first entry (shown above) is set correctly and works fine. The problem comes when I use strcpy() to copy a string into m_bootEntries. If I use strcpy(), it sets all corresponding entries to the same string rather then the one. :///! sets entries 1 to 'n' to this string??
strcpy (m_bootEntries[1], "entry string");Does anyone know where I might of gone wrong? Thanks for any suggestions[smile]