以下のようなソースを記述しています、
c
1void send_content(char* fid, int acc_sd) 2{ 3 write(acc_sd,fid,sizeof(fid)); 4} 5
c++
1 vector<FILEID>::iterator it; 2 char buf[64]; 3//resultはintの値4つを含む構造体の配列でいくつか要素がはいっている。イテレータで順に見ていき、文字列に変換してsend_contentの引数とする。 4 for(it = Result.begin(); it != Result.end(); it++){ 5 fprintf(stderr,"%08x-%08x-%08x-%08x\n",it->first,it->second,it->third,it->fourth); 6 sprintf(buf,"%08x%08x%08x%08x",it->first,it->second,it->third,it->fourth); 7 fprintf(stderr,"%s\n",buf); 8 send_content(buf,soc); 9 } 10
ruby
1 #送信終了までソケットへの書き込みを読み込む 2 while result = sock.gets 3 print("you recieve:",result) 4 end
という流れで行っています。
つまりc,c++のプログラムから文字列を送信しrubyで受信する流れです。
しかし実際にプログラムを動かすと
e:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000%
という出力担ってしまいます。
この原因はなんなのでしょうか?
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。