C++ printf: newline (\n) from commandline argument

前端 未结 7 1748
刺人心
刺人心 2020-12-20 02:07

How print format string passed as argument ?

example.cpp:

#include  
int main(int ac, char* av[]) 
{
     printf(av[1],\"anything\");         


        
7条回答
  •  时光说笑
    2020-12-20 02:58

    There's no way to automatically have the string contain a newline. You'll have to do some kind of string replace on your own before you use the parameter.

提交回复
热议问题