Hi All, Good Morning Folks, i have a small problem in hand not sure if it has anything to do with android platform as such ... i have found that if we have a variable argument function and from within the variable argument function you call up any other function having two parameters then the second parameter address is offset by -0x10... if you guys find any problem with code please let me know, any suggestions and pointer are welcome ...
in the below sample code the parameter temp in the function strMan is offset ... #include <unistd.h> #include <android/log.h> #include <pthread.h> #include <stdio.h> void strMan(char* str, char* temp) { __android_log_print(ANDROID_LOG_INFO, "hello-sample", "before string manipulation %s", temp); //the address of temp is offset by -0x10 strcpy(temp, str); __android_log_print(ANDROID_LOG_INFO, "hello-sample", "after string manipulation %s", temp); } void varfunc(char* str,...) { va_list listOfFileElement; char* temp = NULL; char str1[30]={0}; __android_log_print(ANDROID_LOG_INFO, "hello-sample", "inside var func"); va_start( listOfFileElement, str ); temp = str; while(temp != 0) { memset(str1,0,30); __android_log_print(ANDROID_LOG_INFO, "hello-sample", "inside loop for %s", str1); strMan(temp,str1); __android_log_print(ANDROID_LOG_INFO, "hello-sample", "after loop %s", str1); temp = (char*) va_arg( listOfFileElement, char* ); } } int main(int argc, char* argv[]) { char* hStr = NULL; char* hStr1 = NULL; char* hStr2 = NULL; hStr = (hMyStruct)calloc(1,30); hStr1 = (hMyStruct)calloc(1,30); hStr2 = (hMyStruct)calloc(1,30); strcpy(hStr,"Sanjeeth"); strcpy(hStr1,"Ganapathy"); strcpy(hStr2,"Sanju"); varfunc(hStr,hStr1,hStr2); return 1; } -- unsubscribe: android-porting+unsubscr...@googlegroups.com website: http://groups.google.com/group/android-porting