gpt4 book ai didi

c - fprintf Android NDK

转载 作者:行者123 更新时间:2023-11-30 14:26:23 25 4
gpt4 key购买 nike

有人知道使用 android NDK 时 fprintf 对我不起作用的可能原因吗?

FILE * f = fopen("/sdcard/newfile.txt", "w+");
fprintf(f, "testing\n");

我在 Android list 中确实拥有写入外部存储的权限。此代码创建了一个文件 newfile.txt 但它是空的。

还需要做什么才能让我将内容写入文件吗?

最佳答案

我认为你必须用“fclose”之类的东西关闭流:

FILE * f = fopen("/sdcard/newfile.txt", "w+");
fprintf(f, "testing\n");
fclose(f);

关于c - fprintf Android NDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9180735/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com