{"action":"opened","issue":{"url":"https://api.github.com/repos/irungentoo/toxcore/issues/1359","labels_url":"https://api.github.com/repos/irungentoo/toxcore/issues/1359/labels{/name}","comments_url":"https://api.github.com/repos/irungentoo/toxcore/issues/1359/comments","events_url":"https://api.github.com/repos/irungentoo/toxcore/issues/1359/events","html_url":"https://github.com/irungentoo/toxcore/issues/1359","id":84728047,"number":1359,"title":"tox_new() probleme","user":{"login":"Ogromny","id":10464831,"avatar_url":"https://avatars.githubusercontent.com/u/10464831?v=3","gravatar_id":"","url":"https://api.github.com/users/Ogromny","html_url":"https://github.com/Ogromny","followers_url":"https://api.github.com/users/Ogromny/followers","following_url":"https://api.github.com/users/Ogromny/following{/other_user}","gists_url":"https://api.github.com/users/Ogromny/gists{/gist_id}","starred_url":"https://api.github.com/users/Ogromny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Ogromny/subscriptions","organizations_url":"https://api.github.com/users/Ogromny/orgs","repos_url":"https://api.github.com/users/Ogromny/repos","events_url":"https://api.github.com/users/Ogromny/events{/privacy}","received_events_url":"https://api.github.com/users/Ogromny/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-03T19:13:12Z","updated_at":"2015-06-03T19:13:12Z","closed_at":null,"body":"I,\r\nMy code wont execute i crash at tox_new(), when i execute i get this:\r\n[code]Erreur de segmentation (core dumped)[/code]\r\n\r\n[code]\r\n#include \"main.h\"\r\n\r\n/*\r\n * compiler: gcc\r\n * option:\r\n*/\r\n\r\nint main(void) {\r\n  /* CONVERTION CLEF EN BINAIRE */\r\n  uint8_t *clef_public = malloc(TOX_PUBLIC_KEY_SIZE);\r\n  hex_string_to_bin(BOOTSTRAP_KEY, clef_public);\r\n\r\n  /* CREATION D'UN TOX */\r\n  Tox *m_tox = create_tox();\r\n\r\n  /* PERSONNALISATION DU TOX */\r\n  tox_self_set_name(m_tox, MON_NOM, strlen(MON_NOM), NULL);\r\n  tox_self_set_status_message(m_tox, MON_STATUS, strlen(MON_STATUS), NULL);\r\n  tox_self_set_status(m_tox, TOX_USER_STATUS_AWAY);\r\n\r\n  /* ASSIGNATION */\r\n\r\n  /* BOOTSTRAP */\r\n  tox_bootstrap(m_tox, BOOTSTRAP_ADDRESS, BOOTSTRAP_PORT, clef_public, NULL);\r\n\r\n  /* CONNECTION BOUCLE */\r\n  while (true) {\r\n    /* ITERATION */\r\n    tox_iterate(m_tox);\r\n\r\n    /* CHECK SI CONNECTER */\r\n    int connecter = tox_self_get_connection_status(m_tox);\r\n    printf(\"%d\\n\", connecter);\r\n\r\n    /* SUSPEND L'ITERATION POUR Xs */\r\n    usleep(tox_iteration_interval(m_tox) * 1000);\r\n  }\r\n  tox_kill(m_tox);\r\n\r\n  return 0;\r\n}\r\n\r\nTox *create_tox(void) {\r\n  /* DECLARATION VARIABLE */\r\n  TOX_ERR_NEW tox_err;\r\n\r\n  /* CREATION TOX */\r\n  return tox_new(NULL, &tox_err);\r\n}\r\n\r\nvoid hex_string_to_bin(const char *in, uint8_t *out) {\r\n  size_t len = strlen(in);\r\n  char *value = malloc(len);\r\n\r\n  // si invalide\r\n  if (value == NULL)\r\n    printf(\"[ERREUR]: hex_string_to_bin\\n\");\r\n\r\n  for (size_t i = 0; i < len; i++, in += 2)\r\n    sscanf(in, \"%2hhx\", &value[i]);\r\n\r\n  out = (uint8_t)value;\r\n}\r\n\r\n[/code]\r\n[code]\r\n#ifndef MAIN_H\r\n#define MAIN_H\r\n\r\n#include <stdio.h>\r\n#include <stdlib.h>\r\n#include <string.h> // strlen\r\n#include <unistd.h> // usleep\r\n#include \"toxcore/tox.h\"\r\n\r\n#define BOOTSTRAP_KEY                                                          \\\r\n  \"E398A69646B8CEACA9F0B84F553726C1C49270558C57DF5F3C368F05A7D71354\"\r\n#define BOOTSTRAP_ADDRESS \"195.154.119.113\"\r\n#define BOOTSTRAP_PORT 334455\r\n\r\n#define MON_NOM \"TEST\"\r\n#define MON_STATUS \"TEST\"\r\n\r\n#define SLEEP_TIME 5000 // 5s\r\n\r\nint main(void);\r\nvoid hex_string_to_bin(const char *in, uint8_t *out);\r\nTox *create_tox(void);\r\n\r\n#endif\r\n\r\n[/code]\r\n\r\nwhat is the probleme ?\r\n\r\nPS: I'm french, sorry for my bad english :s"}}