string不是std的成员????
//
#include<iostream>
#include<string>
#include "stdafx.h"
//#include "DLLprocess.h"
using namespace std;
class OutCal
{
public:
OutCal(int L,int C,int R,std::string f);
~OutCal();
int GL();
int GC();
int GR();
std::string GF();
std::string Gfilenamex();
std::string Gfilenamee();
private:
int Level;
int Col;
int Row;
std::string from;
std::string r;
std::string c;
std::string l;
};
OutCal::OutCal(int L, int C, int R, std::string f)
{
Level = L;
Col = C;
Row = R;
from = f;
char strl[3];
sprintf(strl, "%d", Level);
int lLength = strlen(strl);
l = strl;
if (lLength < 2) {
for (int i = 0; i < 2 - lLength; i++) {
l = "0" + l;
}
}
l = "L" + l;
const char* Charl = l.c_str();
int rGroup = 128 * (Row / 128);
char strr[5];
sprintf(strr, "%x", rGroup);
int rLength = strlen(strr);
r = strr;
if (rLength < 4) {
for (int i = 0; i < 4 - rLength; i++) {
r = "0" + r;
}
}
r = "R" + r;
int cGroup = 128 * (Col / 128);
char strc[5];
sprintf(strc, "%x", cGroup);
c = strc;
int cLength = strlen(strc);
if (cLength < 4) {
for (int i = 0; i < 4 - cLength; i++) {
c = "0" + c;
}
}
c = "C" + c;
}
OutCal::~OutCal()
{
}
int OutCal::GL()
{
return Level;
}
int OutCal::GC()
{
return Col;
}
int OutCal::GR()
{
return Row;
}
std::string OutCal::GF()
{
return from;
}
std::string OutCal::Gfilenamex()
{
return from + "/" + l + "/" + r + c + ".bundlx";
}
std::string OutCal::Gfilenamee()
{
return from + "/" + l + "/" + r + c + ".bundle";
}
int main()
{
OutCal OC(2, 6863, 1374, "_alllayers");
cout << OC.Gfilenamee() << endl;
cout << OC.Gfilenamex() << endl;
return 0;
}
相关推荐
C ++:将MFC CString转换为std :: string
在UNICODE中:CString str = L“ Test”; std :: wstring ws(str); std :: string s; s.assign(ws.begin(),ws.end());
利用C++实现从std::string类型到bool型的转换
利用输入字符串流:std::istringstream 代码如下:bool b;std::string s = “true”;std::istringstream(s) >> std::boolalpha >> b;但当字符串s为“1”时,上面的代码无法正确转换,此时应该用: 代码如下:bool b;std::string s = “1”;istringstream(s) >> b;不足:除了加条件判断语句外,暂未找到其它能同时涵盖两种情况的简单方法。 您可能感兴趣的文章:详解C++中String类模拟实现以及深拷贝浅拷贝自己模拟写C++中的St
c++中string类成员函数c_str()的用法
c_str()函数返回一个指向正规c字符串的指针,内容和string类的本身对象是一样的,通过string类的c_str()函数能够把string对象转换成c中的字符串的样式
C++ STL std::string详细讲解
C++ STL std的string详细讲解
C/C++中关于std::string的compare陷阱示例详解
主要给大家介绍了关于C/C++中关于std::string的compare陷阱的相关资料,文中先对C/C++中的std::string进行了简单的介绍,通过示例代码介绍的非常详细,需要的朋友可以参考借鉴,下面随着小编来一起学习学习吧。


