保存到变量而不是打印到屏幕... [英] Save to a Variable instead of print to screen...
本文介绍了保存到变量而不是打印到屏幕...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有此代码正在打印到DOS屏幕上,我不希望这样.我知道在VBA中会是:
I have this code that is printing to the DOS screen, I don''t want that. I know in VBA it would be:
Dim IP as Int
IP = ("\n Source IP: %s", ipSrc);
在C中如何工作
printf("\n Source IP: %s", ipSrc);
DS
How would this work in C
printf("\n Source IP: %s", ipSrc);
DS
推荐答案
您可以使用scanf将值存储在变量中.在此处查看. [
You can use scanf to store the value in a variable. Take a look here.[^]
在Windows中没有"DOS屏幕"之类的东西!
有一些与控制台一起使用的应用程序-将控制台与Windowed UI结合在一起的纯控制台应用程序;例如,"CMD.EXE"就是其中之一.
—SA
There is no such thing as "DOS screen" in Windows!
There are applications working with console — pure console applications of combining console with a Windowed UI; for example, "CMD.EXE" is just one of them.
—SA
您可以使用sprintf()函数.
char szIP [256];
sprintf(szIP,"\ n源IP:%s",ipSrc);
我不确定上面的代码段是否适合您的问题.
You can use sprintf() function.
char szIP[256];
sprintf(szIP, "\n Source IP: %s", ipSrc);
I''m not so sure if the code snippet above is right for your question.
这篇关于保存到变量而不是打印到屏幕...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文