从DirectX 11.2应用程序打开或创建文件
Opening or creating a file from a DirectX 11.2 app
我正试图打开一个.obj文件,该文件包含Blender中球体的顶点和面。问题是,我似乎一辈子都无法打开包含.obj数据的文件。我试着用一种普通的C++方法写入.txt文件,检查应用程序将在哪里创建它,也许还试着把.obj文件放在那个文件夹中。我用来写入.txt文件的代码如下:
std::ofstream myfile("nestotamo.txt");
if (myfile.is_open())
{
myfile << "This is a line.n";
myfile << "This is another line.n";
myfile.close();
}
else DebugPrint("Unable to open file");
我发布的代码不起作用,文件甚至没有创建。我应该从哪里加载.obj文件,为什么我甚至不能创建一个常规的.txt文件来找出应用程序放置它们的位置。
我用来尝试加载数据的代码如下:
std::wifstream fileIn(path.c_str());
if (fileIn)
{
while (fileIn)
{
wchar_t line[64];
fileIn.getline(line, 64);
DebugPrint(line);
}
}
else {
DebugPrint("t The file wasnt loaded...n");
}
任何帮助都将不胜感激。
我发现在处理文件时不能使用常规c++,因为DirectX在处理这些文件时有一些额外的限制。但是,幸运的是,我发现文件需要在以下文件夹中:
Solution_Namex64Debug(or Release)Projekt_NameAppX
我使用的代码是:
std::wifstream fileIn(path.c_str());
if (fileIn)
{
DebugPrint("The file loading begun: nn");
while (fileIn)
{
wchar_t line[64];
memset(line, ' ', 64);
fileIn.getline(line, 64);
DebugPrint(line);
DebugPrint("n");
}
}
else {
DebugPrint("t The file wasnt loaded...n");
}
相关文章:
- 如何从Windows控制台调用.exe(C++)以在不同的目录(或任何目录)中创建文件夹?
- 避免使用 boost::进程间::消息队列创建文件
- 在C++中创建文件夹选取器对话框的最简单方法是什么?
- 如何在软件代码中使用ofstream创建文件
- 在特定 Unicode 路径中创建文件
- 两个线程一个使用流 Api,另一个线程创建文件失败并出现错误ERROR_SHARING_VIOLATION
- 即使使用 FILE_FLAG_DELETE_ON_CLOSE 属性创建文件,文件也会保留在磁盘上
- C++ 为每个结构{人}条目创建文件
- "Access is Denied" U盘上的创建文件()
- 在c++编程中的文件夹中创建文件
- 创建文件夹结构
- 在C++中创建文件夹
- 创建文件函数是否可以打开仅在WinObj实用程序中的全局目录下列出的设备的句柄?
- 使用 C++ 或 SDL 在 Android 中创建文件
- 如何检测哪些进程更改,重命名或创建文件?
- 如何在 Linux 中通过 C/C++ 以其他用户身份创建文件?
- 挂钩创建文件抛出异常:读取访问冲突
- UWP 创建文件2 ERROR_ACCESS_DENIED "NUL"
- 如何指定创建文件函数获取未缓存的结果?
- Open() 用于创建文件和打开现有文件.有人能分辨出其中的区别