ich nach einem ähnlichen Thema suchen zurückkehren, aber ich finde nichtsC/proc printf Wert zu groß
ich eine Funktion in C, welche ich es rekursiv aufrufen. Die prupose dieser Funktion ist es, eine Abfrage zu erstellen, durch eine andere Funktion (Carga_Datos_OptimizadoV2) auszuführen:
int IC_ObtenerReferenciaInstr(char *Entidad, char *treoseq)
{
char *sCampos []={"T0OPINST.NB_REF_1",""};
char *sFormatos []={"C",""};
char **sDatos=NULL;
int lFilas=0;
char sDiagnostico [256];
int lRet;
size_t valorORI=0;
char *sWhereORI=NULL;
valorORI = printf(" where t0opoper.cd_entidad='%s' "
" and t0opoper.nu_operac_ext_eftvo='%s'"
" and t0opoper.cd_entidad=t0opinst.cd_entidad"
" and t0opoper.nu_instruc_princ=t0opinst.nu_instruc",
Entidad,treoseq);
if (valorORI > 0)
{
sWhereORI = (char *)malloc((valorORI + 1) * sizeof(char));
if(sWhereORI != NULL)
{ sprintf(sWhereORI," where t0opoper.cd_entidad='%s' "
" and t0opoper.nu_operac_ext_eftvo='%s'"
" and t0opoper.cd_entidad=t0opinst.cd_entidad"
" and t0opoper.nu_instruc_princ=t0opinst.nu_instruc",
Entidad,treoseq);
lRet=Carga_Datos_OptimizadoV2(sizeof(sFormatos)/sizeof(char *)-1,
sWhereORI,"T0OPOPER,T0OPINST",sCampos,sFormatos,
&sDatos,&lFilas,sDiagnostico,-1);
free(sWhereORI);
sWhereORI=NULL;
}
else
{ sprintf(sWhereORI,"Warning, sWhere2 over in IC_ObtenerReferenciaInstr.");
}
}
else
{return(ERROR);}
if (lRet != 0)
{return((int)lRet);}
if((lFilas>0) && (strcmp(sDatos[0],"")!=0))
{strcpy(treoseq,sDatos[0]); }
return(0L);
}/* end-funcion IC_ObtenerReferenciaInstr */
Das Problem ist in „valorORI“, der fängt die Tapferkeit des printf. Wenn ich es 6 mal rekursiv anrufe, gibt das letzte Mal "printf" den Wert 18446744073709551615 zurück (in den anderen Iterationen gibt es einen Wert zwischen 163 und 170 zurück), was zu einem Abbruch führt, wenn ich de free() in free (whereORI).
Ich habe für eine Lösung, die 3 Tage in Folge ... Dank einem suchen, der mir eine Idee geben könnte :)
Das ist nicht C# ... es ist nicht klar, was C# damit zu tun hat. –
'18446744073709551615' ist' 0xFFFFFFFFFFFFFFFF', was passieren kann, wenn ein 64-Bit Wert '-1' ist –
Das ist richtig, es ist nur C, ich entschuldige mich für den Fehler. –