使用Windows IoT在Raspberry PI上保存文件 [英] Saving files on Raspberry PI with Windows IoT

查看:79
本文介绍了使用Windows IoT在Raspberry PI上保存文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用Windows IoT在Raspberry PI上保存文件有疑问.

I have a question about saving files on Raspberry PI with Windows IoT.

我想做什么: 我有多个要记录的值(温度).对我而言,最简单的方法是编写一个包含所有值的简单txt文件.

What I want to do: I have various values (temperature) which I want to log. The easiest way for me would be, to write a simple txt-file with all the values.

首先:甚至可以在SD卡上本地创建文件吗?因为我发现的代码示例仅在正常" Windows系统上工作:

First of all: Is it even possible to create a file locally on the SD card? Because the code samples I found only work on a "normal" Windows system:

        if (!File.Exists(path))
    {
        // Create a file to write to.
        string createText = "Hello and Welcome" + Environment.NewLine;
        File.WriteAllText(path, createText);
    }

或在Windows Phone上:

or on Windows Phone:

      public void createdirectory()
    {
        IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();
        myIsolatedStorage.CreateDirectory("TextFilesFolder");
        filename = "TextFilesFolder\\Samplefile.txt";
        Create_new_file();
    }

    public void Create_new_file()
    {
        IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication();

        if (!myIsolatedStorage.FileExists(filename))
        {
            using (StreamWriter writeFile = new StreamWriter(new IsolatedStorageFileStream(filename, FileMode.Create, FileAccess.Write, myIsolatedStorage)))
            {
                string someTextData = "This is a test!";
                writeFile.WriteLine(someTextData);
               // writeFile.Close();
            }
        }

Windows Phone的代码对我来说更有意义. (另一个根本不起作用).但是,即使电话代码是正确的代码,我也不知道如何访问内部存储.我已经尝试过IsolatedStorageExplorerTool,但无法识别我的设备.可能是因为我的设备未与USB连接...而且它不是手机.当我使用SSH时,我也找不到目录.

The code for Windows Phone makes more sense to me. (The other doesn't work at all anyway). But even the phone code is the correct one, I have no idea how to get an access to the internal storage. I've tried the IsolatedStorageExplorerTool, but it doesn't recognize my device. Probably because my device is not connected with USB... and it's not a phone. When I use SSH I also can't find the directory.

也许有人有一个主意.预先感谢您的帮助!

Maybe someone has an idea. In advance thanks for your help!

推荐答案

没关系,我找到了解决方案. 1.这是Windows Phone的代码. 2.您必须使用Windows IoT核心监视程序.右键单击您的设备,然后打开网络共享.之后,我在以下位置找到了文本文件: \\ c $ \ Users \ DefaultAccount \ AppData \ Local \ Packages \\ LocalState \ TextFilesFolder

Nevermind, I found the solution. 1. It's the code for Windows phone. 2. You have to use the Windows IoT Core Watcher. Right click on your device and open the network share. Afterwards I found the text file at: \\c$\Users\DefaultAccount\AppData\Local\Packages\\LocalState\TextFilesFolder

这篇关于使用Windows IoT在Raspberry PI上保存文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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