Is there any way of putting a whole word (at once) in a char double array:
char[5][5];
I can't use a string array as the function (SystemParametersInfo) will not accept it and I don't know how to convert it to a single char array.
Thanks
Jon
Printable View
Is there any way of putting a whole word (at once) in a char double array:
char[5][5];
I can't use a string array as the function (SystemParametersInfo) will not accept it and I don't know how to convert it to a single char array.
Thanks
Jon
you can use:
PHP Code:char *mystring[5]=new char[<maxstringlength>];
strcat(mystring[0],"Hello");
a two dimensional array 5x5 is the same as a single dimensioned array of 25, array[16] will for isntance point to element 3,1 (3*15+1)
nabeels786, It's probably me being dumb but your code doesn’t compile. I've tried changing parts of it and compiled it under VC++ and Builder 4 but to no avail.
#include <iostream.h>
#include <string.h>
void main(){
char *mystring1[5]=new char[15];
strcat(mystring[0],"Hello");
}
I want to do the same as this:
string mystring[10];
mystring[1] = "Hello";
mystring[2] = "world;
but with chars as my function doesn't accept strings
or maby just convert mystring[2] into a char array ether way's good.
Sorry for all the stupid questions
Jon
string->char
Code:string myString[10];
myString[0] = "Hello";
myfunc (myString.c_str());
Works only if the function wants a const char* or LPCTSTR or LPCSTR.