Linux上的ftruncate给出了无效参数错误
ftruncate on linux gives invalid arguments error
我从这里以及这里查看了ftruncate
文档。在 IBM 链接的情况下,我相应地实现了我的ftruncate
,但它给了我Invalid Arguments
错误。这是代码:
char const *path = "mozunit.txt";
int file_ = open(path, O_RDONLY, 0600);
int ftrunc_ = ftruncate(file_, 1);
cout<<strerror(errno)<<endl;
这是为什么呢?我尝试更改ftruncate
中的第二个参数,但无济于事。
从ftruncate(2)
手册页:
EBADF or EINVAL fd is not open for writing.
查看您如何以只读方式打开文件...
相关文章:
- 为什么 CRTP 模板C++给出无效参数错误?
- 为什么此字符串在传递到stoi时被视为无效参数
- boost::asio::async_write无效参数
- C ++回测问题:如何检查构造函数在假定失败时是否失败(给定输入的无效参数)
- 无效参数 C++ cygwin
- 套接字接受无效参数 (c++)
- 从带有 getline() 的文件读入一行上有多个信息得到无效参数错误
- 将无效参数传递给将无效参数视为致命的函数
- 如何避免字符串到整数转换情况下的无效参数异常
- 张量流 无效参数:In[0] 不是矩阵
- cudaFreeHost() 无效参数错误
- 未经治疗的例外,无效的参数传递给了一个认为无效参数作用的函数
- C++带有可变参数模板的无效参数
- std::find是否隐式修复无效参数
- 为什么这个程序告诉我传递了无效参数
- 在Win32中获取SetConsolecursorPosition函数的ERRORRORNO 87(无效参数)
- MSVCR120.dll的无效参数错误(在64位窗口中构建Tesseract Lib)
- 在C++中使用字符串类的 .substr 获取无效参数
- MySQL++ 无效参数错误
- 搜索无效参数