[英]access to downloads folder in phone in c language
I need in c language to get to a folder like Downloads this is my path to Download folder : /run/user/1002/gvfs/mtp:host=%5Busb%3A001%2C022%5D/אחסון פנימי/Download 我需要用C语言到达“下载”之类的文件夹,这是我下载文件夹的路径:/ run / user / 1002 / gvfs / mtp:host =%5Busb%3A001%2C022%5D /אחסוןפנימי/ Download
I have the code in java(that work)is but don't know how to do that in c: 我在java(可以工作)中有代码,但是不知道如何在c中做到这一点:
File root2 = android.os.Environment.getExternalStorageDirectory();
File sdcard = new File(root2.getAbsolutePath() + "/download");
sdcard.mkdirs();
File file = new File(sdcard, "XYZ1.txt");
if (!file.exists()) {
try {
file.createNewFile();
}catch (IOException e) {
}
}
I would like to know how to get to Downloads folder in c language tnx for help 我想知道如何进入C语言tnx的下载文件夹以获取帮助
The equivalent C code for the above would be something like this:- 上面的等效C代码将是这样的:
#include <stdio.h>
#include <stdlib.h>
int main()
{
FILE * fp;
FILE *fp = fopen("<relative/absolute path>/XYZ1.txt", "ab+"); //This create file if not present
if (fp==NULL){
printf("Could not create file in loc ..");
}
......
// Do your stuff with the file
......
fclose(fp); //Close the file before leaving
}
More on file IO and modes of file access here 有关文件IO和文件访问模式的更多信息,请点击此处
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.