Home Diary Blog Photo Community Open Source
pointer assgin
a() {
    char *buf = malloc(1024);
    int count;
    fprintf(stdout, "login...\n");
    login_message(conn->conn_fd, &buf, &count);
    sz = send(conn->conn_fd, buf,  count, 0);
    free(buf);
}

login_message(char **data, int *count) {
  unsigned char server_message[]= {0x1f,0x00,0x0a,0x00,0x19,0x00,0x4c,0x6f,0x67,0x69,0x6e,0x20,0x4f,0x4b,0x21,0x0d,0x0a,0x43,0x6f,0x6e,0x74,0x72,0x6f,0x6c,0x20,0x4d,0x6f,0x64,0x65,0x0d,0x0a};

  memcpy(*data, server_message, sizeof(server_message));
  *count = sizeof(server_message);

  return 0;
}