第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. C# 函数式编程:LINQ

    一直以来,我以为 LINQ 是专门用来对不同数据源进行查询的工具,直到我看了这篇十多年前的文章,才发现 LINQ 的功能远不止 Query.这篇文章的内容比较高级,主要写了用 C# 3.0 推出的 L ...

  2. Java并发编程:Java创建线程的三种方式

    目录 引言 创建线程的三种方式 一.继承Thread类 二.实现Runnable接口 三.使用Callable和Future创建线程 三种方式的对比 引言 在日常开发工作中,多线程开发可以说是必备技能 ...

  3. PPT文件流转为图片,并压缩成ZIP文件输出到指定目录

    实现流程: 接收InputStream流->复制流->InputStream流转为PPT->PPT转为图片->所有图片压缩到一个压缩文件下 注意: 1.PPT文件分为2003和 ...

  4. 从函数式编程到Promise

    译者按: 近年来,函数式语言的特性都被其它语言学过去了.JavaScript异步编程中大显神通的Promise,其实源自于函数式编程的Monad! 原文: Functional Computation ...

  5. ngx-echarts响应式图表

    一.代码 html代码 <!-- html --> <nz-card style="background-color: #0e0b2a;border: 0px;color: ...

  6. ​《数据库系统概念》1-数据抽象、模型及SQL

    ​DBMS(database-management system)包括数据库和用于存取数据的程序,DBMS的基本目标是为数据的存取提供方便.高效的方式,此外对大多数企业来说,数据是非常重要的,所以DB ...

  7. Kotlin入门(20)几种常见的对话框

    提醒对话框手机上的App极大地方便了人们的生活,很多业务只需用户拇指一点即可轻松办理,然而这也带来了一定的风险,因为有时候用户并非真的想这么做,只是不小心点了一下而已,如果App不做任何提示的话,继续 ...

  8. Gradle自动实现Android组件化模块构建

    背景 随着App的不断迭代,业务会变得越来越复杂,业务模块会越来越多,且每个模块的代码也会变得越来越多.为了应对这一场景,我们需要把不同的业务模块划分成一个个组件,在修改业务代码的时候只需要在对应模块 ...

  9. OkHttp3源码详解(二) 整体流程

    1.简单使用 同步: @Override public Response execute() throws IOException { synchronized (this) { if (execut ...

  10. python中get pass用法

    python中getpass 模块的作用是输入密码不可见 运行到这脚本不继续运行下去, 打开pycharm中的terminal 如上图显示,password中有输入密码,但不显示