Hy!

I found the problema...

I forgot to put the '&' before the 2nd parameter passed to the function, and
did'n used the second pointer as pointer.

Look:

void ForwardColumnsOnRecord(Char *LastColumn, Char **DestColumn, UInt16
NumColsToAdvance)
{

 int Count;
 int NumChars=0;


 *DestColumn = LastColumn;

 for (Count = 0; Count < NumColsToAdvance; Count++)
 {
  NumChars = NumChars + StrLen(*DestColumn) + 1;
  *DestColumn = LastColumn + NumChars;
 }

return;
}


The function should be called like this:
ForwardColumnsOnRecord(Codigo, &Razao, 1);


Thanks all!





"R�gis Daniel de Oliveira" <[EMAIL PROTECTED]> escreveu na mensagem
news:[EMAIL PROTECTED]
>
>
> Hy all!
>
> I'm trying to build a function that will have 2 pointers as parameters.
>
> When this function is called by the main function, is should modify the
2nd
> parameter and the main function should be able to work with the second
> parameter modified. But, inside the function that work with the pointers,
> everything works well, but, when the second function exits, the pointer of
> main functions hasn't changed. Look the code below:
>
>
> void ForwardColumnsOnRecord(Char *LastColumn, Char *DestColumn, UInt16
> NumColsToAdvance)
> {
>
> int Count;
> int NumChars=0;
>
>
> DestColumn = LastColumn;
>
> for (Count = 0; Count < NumColsToAdvance; Count++)
> {
> NumChars = NumChars + StrLen(DestColumn) + 1;
> DestColumn = LastColumn + NumChars;
> }
>
> return;
> }
>
>
>
> dbPtrF = NULL;
> OpenDatabase(&dbPtrF, "SAF_CLIENTES");
>
>     {
>     MemHandle h;
>     Char *Codigo, *Razao;
>
>     h = DmQueryRecord(dbPtrF, SelectedClientIDX);
>     Codigo = (Char *) MemHandleLock(h);
>
>
>
>
>     ForwardColumnsOnRecord(Codigo, Razao, 1); // here, the pointer Razao
> shoud assume the value that DestColumn assumed inside the code, but it,s
not
> working.
>     }
>
> DmCloseDatabase(dbPtrF);
>
>
> Thanks all, and sorry by the idiot question!
>
>
>
> R�gis Daniel de Oliveira
>
>
>
>



-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to