如何在文件中添加回车符作为字符? [英] How to add a carriage return as a character to a file?

查看:176
本文介绍了如何在文件中添加回车符作为字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个像这样的字符串:

I wanna have a string like:

blablbabla<carriage return goes here>

我的意思是字符串应该包含回车符.有什么简单的方法可以做到吗?或者,如果用c编写程序并将fputs与blablabla\r一起使用,是否可以解决问题?

I mean the string should contain the carriage return. Is there any simple way to do it? Or if a write a program in c and use fputs with blablabla\r, does this do the trick?

推荐答案

如果使用的是vim,则可以进入插入模式并键入'CTRL-v CTRL-m'. ^ M是等效于\ r的键盘. (请参见在vim中插入回车符)

If you're using vim you can enter insert mode and type 'CTRL-v CTRL-m'. That ^M is the keyboard equivalent to \r. (see Insert the carriage return character in vim)

在十六进制编辑器中插入0x0D将完成此任务.

Inserting 0x0D in a hex editor will do the task.

这篇关于如何在文件中添加回车符作为字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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