我在类中找到了这行代码,我必须修改它:
::Configuration * tmpCo = m_configurationDB;//pointer to current db
Run Code Online (Sandbox Code Playgroud)
而且我不知道究竟是什么意思是双重冒号前面的类名.没有它我会读:声明tmpCo作为指向类的对象的指针Configuration...但前面的双冒号混淆了我.
我还发现:
typedef ::config::set ConfigSet;
Run Code Online (Sandbox Code Playgroud) 我正在尝试创建一个带有目录(C:\foo\bar,或..\foo\bar\..\baz,或\\someserver\foo\bar)名称的函数,并根据需要创建目录,以便创建整个路径.
我自己尝试了一个非常天真的实现,它似乎是一个字符串处理的噩梦.有/vs \,有网络共享的特殊情况开始\\(也不能尝试mkdir()路径的前两个级别,即机器名和共享名),并且存在\.\可以存在的类型废话在一条路上.
在C++中是否存在一种简单的方法?
我现在正在为一个基本的虚拟文件系统存档(没有压缩)编写一个提取器.
我的提取器在将文件写入不存在的目录时遇到问题.
提取功能:
void extract(ifstream * ifs, unsigned int offset, unsigned int length, std::string path)
{
char * file = new char[length];
ifs->seekg(offset);
ifs->read(file, length);
ofstream ofs(path.c_str(), ios::out|ios::binary);
ofs.write(file, length);
ofs.close();
cout << patch << ", " << length << endl;
system("pause");
delete [] file;
}
Run Code Online (Sandbox Code Playgroud)
ifs是vfs根文件,offset是文件启动时的值,length是文件长度,path是文件中保存偏移len等的值.
例如,path是data/char/actormotion.txt.
谢谢.
如何使用c ++创建目录/文件夹.我试过使用mkdir()但没有成功.我想编写一个cin是变量的程序,然后使用这个变量来创建子目录和文件.我目前的代码.它说mkdir()中的+运算符表示错误没有操作数
char newFolder[20];
cout << "Enter name of new project without spaces:\n";
cin >> newFolder;
string files[] = {"index.php"};
string dir[] = {"/images","/includes","/includes/js","/contact","about"};
for (int i = 0; i<=5; i++){
mkdir(newFolder + dir[i]);
ofstream write ("index/index.php");
write << "<?php \n \n \n ?>";
write.close();
}
Run Code Online (Sandbox Code Playgroud) 我在查找vs2012所包含的标题上的任何文档时遇到了很多麻烦.我看到它在这里提到但它们没有提供如何使用它的链接.我真正想要的是如何使用它的文档,首选visual studio实现.谢谢
我正在尝试在C程序中创建一个目录,我使用mkdir函数.我的计划如下:
#include <stdio.h>
#include <string.h>
#define MKDIR(x) mkdir(x)
int main() {
//If i do mkdir("foo"), the dir is created
mkdir("~/test/foo"); //Directory foo not created inside test dir
}
Run Code Online (Sandbox Code Playgroud)
dir foo不是在Test dir中创建的.
但我怎么能实现这一目标呢?提前致谢
我正在尝试使用 open 函数创建一个文件,将其称为
dest_fd = open(fileLocation, O_RDWR | O_CREAT, 0666)
Run Code Online (Sandbox Code Playgroud)
当我运行代码时,我得到:
fileLocations: /tmp/folder/file.a
open: No such file or directory
Run Code Online (Sandbox Code Playgroud)
(请注意,我打印了 fileLocation 的值以确保它不是相对路径...)
我试图做我在其他主题上找到的东西,但它似乎不起作用,它可能出了什么问题?
c++ ×6
c ×2
directory ×2
arguments ×1
boost ×1
c++-tr2 ×1
c++11 ×1
file ×1
filestream ×1
mkdir ×1
namespaces ×1
syntax ×1
system-calls ×1
visual-c++ ×1
winapi ×1