如何使用C ++分割文字档 [英] how to split text file using c++

查看:86
本文介绍了如何使用C ++分割文字档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何拆分文本文件并将其复制到另一个文本文件.

how to split text file and copy it to another text file.

推荐答案

这实际上取决于拆分的复杂程度.对于一种非常简单的拆分,您可以使用str_tok来满足,它可以在指定的定界符集上拆分一个字符串.参见此处: http://www.cplusplus.com/reference/clibrary/cstring/strtok/ [ ^ ].

对于更复杂的工作,您可能希望使用正则表达式 [ http://msdn.microsoft.com/zh-cn/library/4384yce9(v = vs.80).aspx [
It really depends on how complex the splitting will be. For a very simple kind of splitting it might suffice for you to use str_tok which breaks up a string on a specified set of delimiters. See here: http://www.cplusplus.com/reference/clibrary/cstring/strtok/[^].

For more complex work you may want to resort to using regular expressions[^]. See here for the MSDN documentation: http://msdn.microsoft.com/en-us/library/4384yce9(v=vs.80).aspx[^].

Cheers!

—MRB


这篇关于如何使用C ++分割文字档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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