Click here to Skip to main content
15,914,111 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralArray of Pointers to Strings Pin
Waleed Eissa29-Aug-02 10:40
Waleed Eissa29-Aug-02 10:40 
GeneralRe: Array of Pointers to Strings Pin
Chris Losinger29-Aug-02 10:42
professionalChris Losinger29-Aug-02 10:42 
GeneralRe: Array of Pointers to Strings Pin
Waleed Eissa29-Aug-02 11:13
Waleed Eissa29-Aug-02 11:13 
GeneralRe: Array of Pointers to Strings Pin
Chris Losinger29-Aug-02 11:26
professionalChris Losinger29-Aug-02 11:26 
GeneralRe: Array of Pointers to Strings Pin
Todd Smith29-Aug-02 13:26
Todd Smith29-Aug-02 13:26 
GeneralRe: Array of Pointers to Strings Pin
Brian Delahunty29-Aug-02 10:46
Brian Delahunty29-Aug-02 10:46 
GeneralRe: Array of Pointers to Strings Pin
Waleed Eissa29-Aug-02 11:11
Waleed Eissa29-Aug-02 11:11 
GeneralRe: Array of Pointers to Strings Pin
Prashant Panigrahi.29-Aug-02 11:11
sussPrashant Panigrahi.29-Aug-02 11:11 
You have ot allocate memory to each of the element os the array before you initialize it with anything.

Try this:

char* pArray[5];

pArray[0] = (char*)calloc(strlen("text1")+1,sizeof(char));
pArray[1] = (char*)calloc(strlen("text2")+1,sizeof(char));
pArray[2] = (char*)calloc(strlen("text3")+1,sizeof(char));
pArray[3] = (char*)calloc(strlen("text4")+1,sizeof(char));
pArray[4] = (char*)calloc(strlen("text5")+1,sizeof(char));

pArray[0] = "text1"
pArray[1] = "text2"
pArray[2] = "text3"
pArray[3] = "text4"
pArray[4] = "text5"

Prashant Panigrahi.

GeneralRe: Array of Pointers to Strings Pin
Joaquín M López Muñoz29-Aug-02 11:21
Joaquín M López Muñoz29-Aug-02 11:21 
GeneralRe: Array of Pointers to Strings Pin
Null_Vector29-Aug-02 11:20
Null_Vector29-Aug-02 11:20 
GeneralRe: Array of Pointers to Strings Pin
Michael Dunn29-Aug-02 12:01
sitebuilderMichael Dunn29-Aug-02 12:01 
GeneralEdit control -- detecting when no more text can be entered Pin
Anonymous29-Aug-02 10:38
Anonymous29-Aug-02 10:38 
GeneralRe: Edit control -- detecting when no more text can be entered Pin
Tomasz Sowinski29-Aug-02 10:52
Tomasz Sowinski29-Aug-02 10:52 
GeneralRe: Edit control -- detecting when no more text can be entered Pin
Anonymous29-Aug-02 10:57
Anonymous29-Aug-02 10:57 
GeneralWierd Letter Pin
Nick Parker29-Aug-02 9:39
protectorNick Parker29-Aug-02 9:39 
GeneralRe: Wierd Letter Pin
Joel Holdsworth29-Aug-02 9:57
Joel Holdsworth29-Aug-02 9:57 
GeneralRe: Wierd Letter Pin
Tomasz Sowinski29-Aug-02 10:06
Tomasz Sowinski29-Aug-02 10:06 
GeneralRe: Listview problems!!! AAAAAAAaaaaaaaaa Pin
Ray Cassick29-Aug-02 9:26
Ray Cassick29-Aug-02 9:26 
GeneralButton control for exiting a program Pin
Brad Jennings29-Aug-02 9:01
Brad Jennings29-Aug-02 9:01 
GeneralRe: Button control for exiting a program Pin
Carlos Antollini29-Aug-02 9:08
Carlos Antollini29-Aug-02 9:08 
GeneralRe: Button control for exiting a program Pin
Brad Jennings29-Aug-02 9:34
Brad Jennings29-Aug-02 9:34 
GeneralRe: Button control for exiting a program Pin
Joaquín M López Muñoz29-Aug-02 9:28
Joaquín M López Muñoz29-Aug-02 9:28 
GeneralRe: Button control for exiting a program Pin
Brad Jennings29-Aug-02 10:04
Brad Jennings29-Aug-02 10:04 
GeneralFile API Question Pin
Nick Parker29-Aug-02 8:37
protectorNick Parker29-Aug-02 8:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.