It seems I tried that method and CW wouldn't allow the Char **. I'll take
another look at it again and make sure.
-----Original Message-----
From: Kerry W. Podolsky <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, March 24, 1999 12:47 PM
Subject: Re: Bad Pointers
>Dave,
>
>I believe this is a codeing error.
>
>What you need to do, is pass the ADDRESS of your pointer to the function,
>so it can put the Handle's ptr INTO the pointer variable.
>
>i.e. your calling code s/b
> FunctionX(MemHandle, &Buffer);
>
>AND inside the called function s/b
> *Result = MemHandleLock(Source);
>Also the function declaration s/b
> UInt FunctionX(Handle Source, CharPtr
*Buffer);
>
>What you're passing to your function is the address INSIDE the pointer
>which is garbage.
>And you're not returning ANYTHING to the calling procedure.
>
>HTH
>
>Kerry
>
>At 11:06 AM 3/24/99 -0500, you wrote:
>>Hi
>>I'm having a problem passing a pointer between functions. I have a
function
>>that takes a Handle and CharPtr. The function locks the handle and
returns
>>the pointer to the string but the CharPtr always returns as NULL (even
>>though the chunk was locked properly). Is this a problem with CodeWarrior
>>(R5) or am I doing this the wrong way?
>>
>>Thanks
>>Dave
>>
>><sample code>
>>CharPtr Buffer;
>>Handle MemHandle;
>>.
>>.
>>.
>>MemHandle = MemHandleNew(size+1);
>>FunctionX(MemHandle,Buffer);
>>// At this point Buffer is NULL - Why?
>>.
>>.
>>.
>>
>>UInt FunctionX(Handle Source,CharPtr Result)
>>{
>>// do stuff that doesn't impact result or source
>>
>>Result = MemHandleLock(Source);
>>// Result is the correct value here
>>
>>return retval;
>>}
>>
>>
>>
>>
>>
>Kerry W. Podolsky
>[EMAIL PROTECTED]
>
>