VC++中遇到string的问题 //得到文件中的内容len=fgetc(fp1);printf("%c",len);int i=0;temp[i]=....转化一下 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 using namespace std; 不能用??所有关于string的函数都不能用。象strlen()... #include <stdio.h>#include <stdlib.h>#include <string.h>#include <iostream.h>#include "stdafx.h" 不知道是怎么回事,还是不能用??? #include<iostream>using namespace std; strlen 来操作 string 对象?string 是对象,不是 char*要取string的长度,使用lengthstring s("test");size_t nLen = s.length(); 末尾加".h"的是C风格的头文件,在C里好象没有string,因此只能使用#include <iostream>#include <string>using namespace std;这是一种STL格式 #include <stdio.h> #include <stdlib.h> #include <string> #include <iostream>using namespace std; #include "stdafx.h "加了命名空间才可以使用string类!读字符串可以直接用 fgets(temp,10,fp);可以直接定义一个string对象把内容全部读出来,用C++的输入输出流更好 问题1:在程序中不能定义string类型的参数,是怎么回事? 问题2:怎以将1.txt中的内容放到int temp[10]中, 1.txt中存的都是数字类型#include<string>using namespace std;(char)temp[i]; 在direct3D中播放视频时背景是暗红色是怎么回事? photoshop插件开发,dll调用出错 有关类的涵数的调用? 什么是完成端口啊?谁能不能提供些资料 关于ListCtrl的两个问题, 请教:如何将PropertSheet上的六个PropertPage上的选项值保存到文档中去 添加自己的类,怎样加到应用程序中? 鼠标选中CListCtrl上一行时,怎么获取它的坐标? 如何能知道,自己拨号上网时,电信分配的IP地址 大家帮帮忙! 如何求string变量中字符的长度? 图片快速移动的问题
#include <stdlib.h>
#include <string.h>
#include <iostream.h>
#include "stdafx.h" 不知道是怎么回事,还是不能用???
using namespace std;
string 是对象,不是 char*要取string的长度,使用lengthstring s("test");
size_t nLen = s.length();
#include <iostream>
#include <string>
using namespace std;
这是一种STL格式
#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;
#include "stdafx.h "
加了命名空间才可以使用string类!读字符串可以直接用 fgets(temp,10,fp);可以直接定义一个string对象把内容全部读出来,用C++的输入输出流更好
问题2:怎以将1.txt中的内容放到int temp[10]中, 1.txt中存的都是数字类型#include<string>
using namespace std;
(char)temp[i];