Re: dynamically allocate array variable of type LPWSTR
- From: Ulrich Eckhardt <doomster@xxxxxxxx>
- Date: Fri, 31 Oct 2008 18:16:10 +0100
Trups wrote:
I want to dynamically allocate array variable of type LPWSTR.
Two things here:
1. LPWSTR is not a standard type but part of the win32 API.
2. LPWSTR is a pointer type, hence the 'P'. In fact it's a typedef for
wchar_t*.
Code looks like this...
main() {
Well, check the FAQ on this one.
LPWSTR *wstr;
int count = Foo (wstr);
You are passing the value of an uninitialised variable to a function. If you
want the function to init the variable, you need to pass its address.
int Foo(LPWSTR *wstr)
{
int count = 0;
while (!done){
//Here I need to allocate "wstr" one element by one element.
How
to do that?
// I don't know the count
count ++;
}
This looks as if you wanted to allocate an array of wchar_t strings.
However, I have actually no clue what it is that you really want.
Where should I do delete?
'delete' is a C++ thing, in C you would use malloc() and free().
Sorry, but there is too little to start with. I would suggest you get a good
book or some other tutorial that introduces you step by step to C. If
you're not familiar with programming at all, I would further suggest using
a language with less pitfalls, like e.g. Python.
Uli
.
- References:
- Prev by Date: Re: opening jpeg file in c++
- Next by Date: Re: floating point number help
- Previous by thread: dynamically allocate array variable of type LPWSTR
- Next by thread: Re: dynamically allocate array variable of type LPWSTR
- Index(es):
Relevant Pages
|