Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

void friend_message_cb issue with "friend_number" ? #1636

Open
Artysteel opened this issue Mar 26, 2017 · 4 comments
Open

void friend_message_cb issue with "friend_number" ? #1636

Artysteel opened this issue Mar 26, 2017 · 4 comments

Comments

@Artysteel
Copy link

Artysteel commented Mar 26, 2017

Good day,

I am trying to print out the value of a friend, who sent message. No matter what I am trying, can't get it to work. I've looked into your code in other *.c files, and you were printing "uint32_t friend_number" normaly with printf.

How I've tried so far:
#include <inttypes.h> //for PRI and etc

void friend_message_cb(Tox *tox, uint32_t friend_number, TOX_MESSAGE_TYPE type, const uint8_t *message, size_t length, void *user_data){

printf("1: %lu \n", friend_number);
printf("2: %lu \n", (unsigned long)friend_number );
printf("3: %"PRIu32"\n" , (uint32_t) friend_number ) ;

}

@GrayHatter
Copy link
Collaborator

That should work. What compiler are you using? What does it print? and have you tried simply %u?

@Artysteel
Copy link
Author

Artysteel commented Mar 27, 2017

GCC. Yes I did. It either prints 0 or 1, depends on what I am using

@GrayHatter
Copy link
Collaborator

why do you think that number is wrong?

@Artysteel
Copy link
Author

Ah yes, sorry, everything is ok. I managed to figure out that this parameter stands for virtual ID of a friend (not its TOX ID, but an index number in the list)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants