While debugging my native code I wrote these lines:
m_sock = socket(m_iAf, m_iType, m_iProtocol);
printf("errno = %d, %s\n", errno, strerror(errno));
printf("Hellowrold\n");
I created a socket, but when i execute this line, it’s returning negative.
So I have to find the error. But the printing of neither errno nor Helloworld is shown on the console.
How can I see the printed lines?
I am new with ndk-gdb, so need help please.
Thanks,
Riasat
Instead of printf you can use the android logging facility:
No need for the trailing “\n” here and these will show up in logcat. You need to link to the logging library too. In your Android.mk file, add the following: