|
-
Jan 31st, 2002, 08:52 AM
#1
Char array arrays
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
-
Jan 31st, 2002, 08:57 AM
#2
Fanatic Member
you can use:
PHP Code:
char *mystring[5]=new char[<maxstringlength>];
strcat(mystring[0],"Hello");
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Jan 31st, 2002, 09:23 AM
#3
transcendental analytic
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)
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jan 31st, 2002, 12:36 PM
#4
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
-
Jan 31st, 2002, 04:09 PM
#5
Hyperactive Member
string->char
Code:
string myString[10];
myString[0] = "Hello";
myfunc (myString.c_str());
-
Feb 1st, 2002, 07:57 AM
#6
Works only if the function wants a const char* or LPCTSTR or LPCSTR.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|