-1

これは最終的なコードで、コンパイル エラーはありませんが、「引数が無効です」というエラーが引き続き発生します!! ================================================== ======================

含む

using namespace std;
#include <sys/socket.h>
#include <linux/x25.h>
#include <stdio.h>

#include <sys/types.h>
#include <linux/socket.h>
#include <netinet/in.h>
#include <sys/un.h>
#include <string.h>
#include <errno.h>



int main(int argc,char **argv,char **envp) {

    int x25_socket;
    struct sockaddr_x25 x25_address = {0};

    char x25_host[] ="10.0.0.1";
    const char name[] = "my name";

    x25_address.sx25_family = AF_X25;

    x25_socket = socket(AF_X25, SOCK_SEQPACKET, 0);
     if (x25_socket == -1)
              cout << "error in create socket" << endl;

     strncpy(x25_address.sx25_addr.x25_addr, x25_host, 16);


    int bindNumber = bind(x25_socket,(struct sockaddr *)&x25_address,sizeof(x25_address));
     if (bindNumber == -1)
     {
         perror("error in bind ---");
         cout << "error in bind" << endl;
     }

     cout << write(x25_socket, name, 2) << endl;

    return 0;
}
4

2 に答える 2