I am trying to save a bmp into file in my C++ android app (I am working with chromium project).
FILE* fp = fopen("/myimage.bmp", "wb"); // result: fp==NULL, errno==30
FILE* fp = fopen("/Pictures/myimage.bmp", "wb"); // result: fp==NULL, errno==2
If you're accessing your internal storage of your application then the root path of your application storage is
String ROOT_PATH = "/data/data/" + "com.your.package.name" + "/";
So in case of accessing your file from your internal storage you have to declare the file path like this.
FILE* fp = fopen(ROOT_PATH + "myimage.bmp", "wb");
But this doesn't ensure your problem to be solved as @CommonsWare suggested,
"the root path of your application storage is" -- the path varies by OS version, user account (primary vs. secondary), and possibly device manufacturer. NEVER HARDCODE PATHS. If NDK code needs to write to a location, Java code should be passing in the path, where that is derived from a method (e.g., getFilesDir()).
So I'm referring to his comment again in your question.
You cannot write to / on any Linux-based system without superuser-level privileges. "I am working with chromium project" -- then figure out where Chromium writes files, and write your files there.
These are some valuable insights suggested by @CommonsWare which might help you. Thanks.