您可以使用C 从在线编译器(repl.it)打开文件吗?
Can you open a file from a an online compiler (repl.it) using C++
我想看看是否可以打开文件,使用在线编译器写入并保存它。我之所以使用它的原因是因为我使用的是一个很难运行Xcode或CodeBlocks的MacBook。我要打开的文件保存在我的桌面上的文件名" image.ppm"下。这是代码:
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{
char filename[100];
ifstream input;
cin.getline(filename, 100);
input.open(filename);
}
当我运行时,什么也不会发生,我认为这是因为在线编译器看不到image.ppm文件
是否允许您读/写文件是无关紧要的;当然,它无法在您的计算机上看到文件。
相关文章:
- .cpp和.h文件中的模板专用化声明
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 文本文件中的单词链表
- CMake-按正确顺序将项目与C运行时对象文件链接
- 使用新行和不使用新行读取文件
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 挂起和取消挂起一个文件DLL
- 如何确定我已使用非编码文件到达 EOF?
- 命名空间中具有.h和.cpp文件的类
- 如何使用ndk-build.cmd构建Android.so文件
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 读取文件并输入到矢量中
- 在C++中查找文件
- c++库的公共头文件中应该包含什么
- 用c++从输入文件中读取另一行
- Cppcheck生成xml转储文件
- 读取文件的最后一行并输入到链接列表时出错
- 您可以使用C 从在线编译器(repl.it)打开文件吗?
- C++ " I want to add a new string at the end of the file How Can I do it? please help"中的文件处理
- 无法在另一台计算机上运行我的 exe 文件。 "Application requested the runtime to terminate it in an unusual way"错误