C++中文件名称必须是C风格的char*格式
来源:互联网 发布:小灰熊软件制作 编辑:程序博客网 时间:2024/06/06 03:54
File Names in C++
For historical reasons, the IO library uses C-style character strings (Section
4.3 , p. 130 ) rather than C++ strings to refer to file names. When we call
open or use a file name as the initializer when creating an fstream object, the
argument we pass is a C-style string, not a library string . Often our
programs obtain file names by reading the standard input. As usual, it is a
good idea to read into a string , not a C-style character array. Assuming
that the name of the file we wish to use is in a string , we can use the c_str
member (Section 4.3.2 , p. 139 ) to obtain a C-style string.
在C++ Primer一书中明确说明了,C++中读入文件操作(fstream类),中的文件名称必须是C_Style名称,
而是用C++ 时使用更多的是 library string , 利用string读入,调用函数c_str转换成char* (C_style)类型的文件
在OpenCV中的cvLoadImage参数也是char* 类型.
OpenCV中的imread 函数参数则是string类型的.
- C++中文件名称必须是C风格的char*格式
- 转换成C风格的char *字符串
- c语言中char的-128是怎么计算的
- C语言编程中return 0是必须的吗?
- c 中char * 和 char []的区别
- 使用C风格字符串你必须知道的几点
- Jquery中eval执行的必须是满足json格式
- C语言测试是招聘嵌入式系统程序员过程中必须而且有效的方
- C语言测试是招聘嵌入式系统程序员过程中必须而且有效的方法
- 【C++】C++中拷贝构造函数的参数类型必须是引用
- C语言中 char 类型的取值范围为什么是-128~127
- c语言中:字符 char的描述
- C/C++中signed char的范围
- 纯c中char*[]的处理
- C语言中char * 和 char []的区别
- C语言中char * 和 char []的区别
- C语言中char * 和 char []的区别
- C/C++中char* 与char []定义的区别
- 五大算法之二--动态规划
- 使用AT命令和GPRS无线模块开发(软件)
- oracle 查询日期实用
- vc 任务计划
- mangento产品数量的调出以及灵活运用
- C++中文件名称必须是C风格的char*格式
- Android源码分析
- Mesoeconomics中观经济学
- Eclipse debug (调试) 学习心得
- 色值表
- jquery 图片延迟加载
- How to make text of an html checkbox clickable (like ASP.NET control)
- 编译smdkv210开发板自带的android2.3源码generic版
- VC++6.0 Debug模式与Release模式的区别