第1种字符串赋值方式:

char * fileName="./2017-09-02-10-34-10.xml";//这一种字符串赋值方式已经被ISO禁止了

第2种字符串赋值方式:

    char str[] ="./2017-09-02-10-34-10.xml";
char *fileName=str;

第3种字符串赋值方式:

char fileName[] ={"./2017-09-02-10-34-10.xml"};//有无大括号都可以

warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

解决办法:采用第2或3种字符串赋值方式

int main(int argc, char *argv[])
{
char str[] = ""; //先把C++中的string常量复制给C语言形式的字符串变量,再将str赋值给char*形式的C语言字符串。
argv[] = str;
}

warning: ISO C++ forbids converting a string constant to 'char*'的更多相关文章

  1. warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]

    在C++中, char* p = "abc"; // valid in C, invalid in C++ 会跳出警告:warning: ISO C++ forbids conve ...

  2. warning: deprecated conversion from string constant to 'char*

    warning: deprecated conversion from string constant to 'char* #include<iostream> using namespa ...

  3. deprecated conversion from string constant to ‘char*’

    deprecated conversion from string constant to ‘char*’ #include <iostream> using namespace std; ...

  4. warning:deprecated conversion from string constant to 'char *' 解决方案

    #include <iostream> using namespace std; int fuc(char *a) { cout << a << endl; } i ...

  5. warning:deprecated conversion from string constant to &#39;char *&#39;

    warning:deprecated conversion from string constant to 'char *' 解决方式 #include <iostream> using ...

  6. warning:ISO C90 forbids mixed declarations and code

    warning:ISO C90 forbids mixed declarations and code 变量定义之前不论什么一条非变量定义的语句(重视:语句是会带分号的)都会引起这个警告! 将非变量的 ...

  7. expected declaration specifiers or '...' before string constant

    /work/platform_bus_dev_drv/led_dev.c:52: error: expected declaration specifiers or '...' before stri ...

  8. ISO C90 forbids mixed declarations and code 警告

    编译的时候经常会遇到   ISO C90 forbids mixed declarations and code 警告百度了一下,知道是如下原因 : 变量定义之前任何一条非变量定义的语句(注意:语句是 ...

  9. qt ISO C++ forbids declaration of 'XXXX' with no type

    error: ISO C++ forbids declaration of 'XXXX' with no type   出现这个错误,一般是由于两个CPP相互都相互包含了对方的头文件造成的,比如: 当 ...

随机推荐

  1. cocoapods使用-库托管到svn或者github

    下拉svn库(自定义库或者第三方库)到工程中:   1. 若未安装,请安装cocoapods:    http://www.cnblogs.com/sunjianfei/p/6089231.html ...

  2. HDU6205

    card card card Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...

  3. 【代码笔记】Web-HTML-布局

    一, 效果图. 二,代码. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> ...

  4. 从零开始学习html(八)CSS选择器——下

    六.子选择器 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" ...

  5. IO事件驱动模型

    1:IO事件驱动模型简介 通常,我们写服务器处理模型的程序时,有以下几种模型: (1)每收到一个请求,创建一个新的进程,来处理该请求: (2)每收到一个请求,创建一个新的线程,来处理该请求: (3)每 ...

  6. 外网访问局域网ip的方法

    https://jingyan.baidu.com/article/48b558e335e3ac7f39c09a59.html 步骤: 1.浏览器内输入:192.168.1.1进入路由器管理界面 2. ...

  7. WTL汉化版

    基于 WTL90_4060 仅汉化了Windows部分,CE和Mobile未汉化 AppWizard和rc文件已全部汉化 如果不需要汉化则将所有的2052目录删除即可 如有问题可以给我留言 点我下载

  8. 鸟哥的 Linux 私房菜Shell Scripts篇(二)

    参考: http://linux.vbird.org/linux_basic/0340bashshell-scripts.php#script_be http://www.runoob.com/lin ...

  9. Nginx安装成Windows服务

    因为有项目使用Nginx来做负载均衡,但是Nginx的Windows版本是不提供安装成服务的,所以服务器重启后Nginx并不会伴随启动和恢复.网上查了下,这里记录下解决方法,防止遗忘. 第一步:下载W ...

  10. Linux初学 - Centos7忘记root密码的解决办法

    开机进入启动界面后,要按照屏幕的下方的操作提示迅速按下“e”键. 按下“e”键后即来到启动文件界面,这时按键盘上面的方向键“下”,一直到文件底部,在"LANG=zh_cn.UTF-8&quo ...