Stringの罠
文字列は孔明の罠ばっかりです・・・
見えなすぎる・・・
string st; char c[1]; c[0] = 't' st.append(c); c[0] = 'e' st.append(c); c[0] = 's' st.append(c); c[0] = 't' st.append(c);
↓結果 (10はDLE?)
in>>74 in>>10 in>>65 in>>10 in>>73 in>>10 in>>74 in>>10 in>>D in>>10 in>>A in>>10 len>>12
これでtestの文字列が出来ると思いきや、なにやらDLEとかいうのが文字と文字と間に挟まってしまう・・・
どおりでパーサーが読めないわけだ・・・
string st; char c[1]; c[0] = 't' st.append(c,1); c[0] = 'e' st.append(c,1); c[0] = 's' st.append(c,1); c[0] = 't' st.append(c,1);
↓きれいな結果
in>>74 in>>65 in>>73 in>>74 in>>D in>>A len>>6
文字数を指定してappendしたらうまくいった orz
アスキーコード表は以下を参照した。
http://hpcgi3.nifty.com/prismwave/wiki/wiki.cgi?p=ASCII%A5%B3%A1%BC%A5%C9%C9%BD