0

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!!!

2
  • is arrayM a typo, that should just be array? Commented Nov 8, 2013 at 21:45
  • 1
    If you want to use strings, why not use strings? Commented Nov 8, 2013 at 21:58

2 Answers 2

2

LPWSTR is a wide string, so is swprintf.

Therefore, you want

array[i] = new wchar_t[13];
Sign up to request clarification or add additional context in comments.

Comments

0

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>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.