C ++/CLI AppendText无需使用新行即可进行文档编制 [英] C++/ CLI AppendText to document without using new line

查看:62
本文介绍了C ++/CLI AppendText无需使用新行即可进行文档编制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



感谢您看我的问题

我可以使用流编写器将文本追加到文档中.但是,如果我每次添加数据时都要换行.我希望将数据附加到同一行.
这有可能吗?这是我正在写的代码.

Hi,

Thanks for looking at my questions

I am able to append text to a document using stream writer. However if makes a new line each time i append data. I would like it to append data to the same line.
Is this even possible?? Here is the code were I am doing the writing.

String^ data = serialPort1->ReadExisting();
StreamWriter^ sw= File::AppendText(fileloc->Text);
sw->WriteLine(data);
                   

sw->Flush();
sw->Close();

推荐答案

您需要更改
You need to change
String^ data = serialPort1->ReadExisting();
StreamWriter^ sw= File::AppendText(fileloc->Text);
sw->WriteLine(data);

sw->Flush();
sw->Close();







to

String^ data = serialPort1->ReadExisting();
StreamWriter^ sw= File::AppendText(fileloc->Text);
sw->Write(data);

sw->Flush();
sw->Close();



我建议您也从这里查找可能错过的其他功能.

http://msdn.microsoft.com/en-us/library/system.io. streamwriter.aspx [^ ]



I suggest you look here as well for other functions you might have missed.

http://msdn.microsoft.com/en-us/library/system.io.streamwriter.aspx[^]


这篇关于C ++/CLI AppendText无需使用新行即可进行文档编制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆