返回信息流~windows窗体,C++编的。怎么把textbox获取的String数据写入到txt里?
我这样直接放不行!
std:: ofstream f1;
f1.open("Users.txt",std::ios::app);
f1<<maskedTextBox1->Text;
紧急求助大牛指点!先谢了!
ps:窗体的代码好奇怪啊,哪位前辈用C++编过窗体可以给点建议么?
这是一条镜像帖。来源:北邮人论坛 / dot-net / #1868同步于 2010/5/31
该镜像源已超过 30 天没有更新,可能在源站已被删除。
dotNET机器人发帖
[求助]查了好多网上和和书的方法都不行!~windows窗体,C++编
qfx424609959
2010/5/31镜像同步7 回复
订阅后,新回复会通过你的通知中心匿名送达。
7 条回复
【 在 ericyosho 的大作中提到: 】
: 你这代码是写在监听器里面的么?还是直接写在绘制图形的代码里面?
: --
直接写在一个“确定”按钮的响应函数里
C++中的string跟.NET中的String,是不一样的,
建议txtbox的文本内容,先转成char*,然后构造一个c++ string,再传给std的文本流
【 在 ericyosho 的大作中提到: 】
: 请把你的错误信息贴出来,光说有问题,咋知道啥问题。
: --
g:\vs project\唱诗班\唱诗班\Form1.h(136): error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'System::String ^' (or there is no acceptable conversion)
1> D:\Microsoft Visual Studio 10.0\VC\include\ostream(679): could be 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' [found using argument-dependent lookup]
既然是.net就都用.net呗
【 在 qfx424609959 的大作中提到: 】
: g:\vs project\唱诗班\唱诗班\Form1.h(136): error C2679: binary '<<' : no operator found which takes a right-hand operand of type 'System::String ^' (or there is no acceptable conversion)
: 1> D:\Microsoft Visual Studio 10.0\VC\include\ostream(679): could be 'std::basic_ostream<_Elem,_Traits> &std::operator <<<char,std::char_traits<char>>(std::basic_ostream<_Elem,_Traits> &,const char *)' [found using argument-dependent lookup]