Comments (5)
Please post source code next time, especially your C file is short.
I don't understand your environment, --dir=./Data
will use Data/
as current directory from my understanding, and your code is trying to open a file named Data
. Might you expand more?
In this sense, you will need to provide full steps including how you prepare your file system for the program.
from wasmedge.
Please post source code next time, especially your C file is short.
I don't understand your environment,
--dir=./Data
will useData/
as current directory from my understanding, and your code is trying to open a file namedData
. Might you expand more?In this sense, you will need to provide full steps including how you prepare your file system for the program.
Thanks for your reply!
The c file is already uploaded a s test-c.txt, and the wasm file is already uploaded as test-wasm.txt, since .c and .wasm file cannot be uploaded. Please download the file and change the suffic.
from wasmedge.
No, I mean you can just post C code in code block.
from wasmedge.
No, I mean you can just post C code in code block.
Ok, here's the c code:
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
int path_remove_directory(int basedir_fd, const char *file_name) {
if (unlinkat(basedir_fd, file_name, AT_REMOVEDIR) == -1) {
printf("Error deleting file.\n");
close(basedir_fd);
return 1;
}
printf("File deleted successfully.\n");
return basedir_fd;
}
int get_fd(const char* file_name, int open_style){
int fd = open(file_name, open_style);
if (fd == -1) {
perror("Failed to open the file.\n");
}else{
printf("Successfullly get the fle fd.\n");
}
return fd;
}
int main() {
const char* file_name = "Data";
int open_style= O_RDWR;
int fd = get_fd(file_name, open_style);
if (fd != -1){
const char *file_name = "tmpdir";
path_remove_directory(fd, file_name);
}
return 0;
}
from wasmedge.
This is not a bug with WasmEdge, you just need to change your O_RDWR
to O_RDONLY
. bytecodealliance/wasm-micro-runtime#2884
from wasmedge.
Related Issues (20)
- feat: Provide CUDA 11.3 pre-built ggml plugin HOT 1
- feat: Support `--main-gpu` in the ggml plugin
- feat: Support `--tensor-split` in the ggml plugin
- How can I run wasmedge on Windows11 with GGML plugin HOT 2
- Bug: (WASI) Failed to create directory with trailing backslash HOT 3
- bug: Can't install Rust TLS plugin on Mac OS HOT 11
- feat: Support auto-detect CUDA version for the ggml plugin in the installer
- bug: Remove `._*.*` files on macOS in the installer HOT 1
- Building WASM from source on android HOT 6
- bug: WasmEdge `0.14.0-alpha.2` doesn't work on macOS, at least due to a lack of `libprotobuf.25.1.0` and `libgrpc++.1.60.dylib`.
- WASI-NN with GPU on Jetson Orin Nano HOT 6
- LFX Workspace: Integrate burn.rs as a new WASI-NN backend HOT 4
- bug: LlamaEdge 0.4.0 installation on Mac Intel model, missing file ' WasmEdge-plugin-wasmedge_rustls-0.13.5-darwin_x86_64.tar.gz' HOT 3
- bug: Randomly fail of Windows or Windows-MSVC test for LLVM HOT 2
- question: module name conflict when loading rustls plugin HOT 2
- LFX Workspace: Integrate Intel Extension for Transformers as a new WASI-NN backend HOT 5
- question: LLamaEdge installation failed in Raspberry Pi OS HOT 4
- feat: Support Qwen-VL model HOT 4
- LFX Workspace: Integrate MLX as a new WASI-NN backend HOT 3
- Use `println!` in rust will make the execution terminated on the Windows environment. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasmedge.