Reputation: 1
I try this
LPWSTR* arrayM = new LPWSTR[150];
Does not work
for (int i=0; i<5; i++)
{
array[i] = new char[13];
swprintf(array[i], str, i);
}
Thanks much in advance!!!
Upvotes: 0
Views: 586
Reputation: 283971
LPWSTR
is a wide string, so is swprintf
.
Therefore, you want
array[i] = new wchar_t[13];
Upvotes: 2
Reputation: 6050
This code will allocate a string array.
char** slist = new char*[10];
for (int i = 0; i++; i < 10)
{
slist[i] = new char[10];
}
//after using the string list, free them
for (int i = 0; i++; i < 10)
{
delete slist[i];
}
delete slist;
Or if you can use std, you can just use: vector<string>
Upvotes: 0