C#访问在microSD中创建/写入文件 [英] C# access creating/writing files in microSD

查看:64
本文介绍了C#访问在microSD中创建/写入文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有Windows 10 iot的raspberry pi 2。我想用c#应用程序在microSD卡中创建目录/文件。我该怎么做?

当我尝试这样做时,我收到错误:

Hi, I have raspberry pi 2 with Windows 10 iot. I want to create directories/files in microSD card using c# application. How do I do that?
When I try to do that I get error:

"访问路径"C:\ poo.ini"被拒绝。"

我尝试执行:  icacls" c:\ work" /授予每个人:F

但这不起作用。



任何想法?

I tried execute: icacls "c:\work" /grant Everyone:F
but that doesnt work.

Any ideas?

I
有一个巨大的32GB microSD卡有22GB免费分区(E :),我无法访问它?
如何访问卷E:? KnownFolders
是否包含E:分区?

有没有黑客解决方案?




推荐答案

UWP应用程序无法访问更广泛的文件系统。尝试使用KnownFolders访问文件。 '可移动存储'/可移动设备'是USB数据存储的代码和权限所需的。

It is not possible from a UWP app to access the wider filing system. Try using the KnownFolders to access files. 'Removable Storage'/Removable Devices' is what you need for code and permissions for USB data storage.

C:\ ...仅通过KnownFolders

C:\... is only via KnownFolders

19。在C#中打开一个文件以进行读/写操作。


19. Open a file in C# for access to read/write it

    // create a file with the given filename in the local folder; replace any existing file with the same name
    StorageFile file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync(filename, CreationCollisionOption.ReplaceExisting);


这篇关于C#访问在microSD中创建/写入文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆