在cout文本中寻找 [英] seeking in cout text
问题描述
有没有办法在cout''d $ / b
之后跟踪x个字符,并覆盖部分字符?
is there any way to track back x number of characters after its been cout ''d
, and overwrite part of it ?
推荐答案
" Philip Parker" <博士** @ parker246.freeserve.co.uk>在消息中写道
新闻:c8 ********** @ news7.svr.pol.co.uk ...
"Philip Parker" <Ph**@parker246.freeserve.co.uk> wrote in message
news:c8**********@news7.svr.pol.co.uk...
有什么方法可以跟踪x个字符后的字符数
''d,并覆盖部分字符?
is there any way to track back x number of characters after its been cout ''d , and overwrite part of it ?
否,至少不是标准C ++中的字符。您应该忘记cout和
而不是使用您的平台提供的任何控制台功能。这绝对是可能的,但不是标准的C ++。
john
No, at least not in standard C++.. You should probably forget about cout and
instead use whatever console functions your platform provides. This is
definitely possible, just not in standard C++.
john
>> ;有没有办法在cout
>> is there any way to track back x number of characters after its been cout
''d
之后跟踪x个字符,并覆盖部分字符?
, and overwrite part of it ?
<不,至少在标准C ++中没有。你应该忘记cout和
而是使用平台提供的任何控制台功能。这绝对是可能的,而不是标准的C ++。
No, at least not in standard C++.. You should probably forget about cout and
instead use whatever console functions your platform provides. This is
definitely possible, just not in standard C++.
也许使用一个继承自cout的新类?
int :: cout(char * s){
real_cout<< s;
返回strlen(s);
}
当然,像cout<< " BLA" << " FOO"那时候不行。
Jan Engelhardt
-
Maybe using a new class which inherits from cout?
int ::cout(char *s) {
real_cout << s;
return strlen(s);
}
Of course, something like cout << "bla" << "foo" won''t work then.
Jan Engelhardt
--
" Jan Engelhardt" < JE ***** @ linux01.gwdg.de>在消息中写道
新闻:Pi ******************************* @ yvahk01.tjq t .qr ...
"Jan Engelhardt" <je*****@linux01.gwdg.de> wrote in message
news:Pi*******************************@yvahk01.tjq t.qr...
有没有办法在
$ b $之后跟踪x个字符数b cout''d
cout''d
,并覆盖它的一部分?
不,至少不是标准的C ++ ..你应该忘记cout
并且不使用任何控制台功能你的平台提供。这肯定是可能的,只是不是标准的C ++。
, and overwrite part of it ?
No, at least not in standard C++.. You should probably forget about cout andinstead use whatever console functions your platform provides. This is
definitely possible, just not in standard C++.
也许使用一个继承自cout的新类?
Maybe using a new class which inherits from cout?
cout是一个全局变量而不是一个类,所以你不能继承它。
int :: cout(char * s){
real_cout<< s;
返回strlen(s);
}
cout is a global variable not a class, so you can''t inherit from it.
int ::cout(char *s) {
real_cout << s;
return strlen(s);
}
这段代码对我没有意义,但无论如何你不要在cout中有'退后'的能力然后我不能看到你可以以某种方式获得
这种能力而不使用一些非标准的C ++ 。
john
That code makes no sense to me, but in any case if you don''t have the
ability to ''step back'' in cout then I can''t see that you could somehow get
that ability without using some non-standard C++.
john
这篇关于在cout文本中寻找的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!