我如何写一个文本文件到我的智能手机闪存驱动器连接在usb
本文关键字:闪存 智能手机 驱动器 连接 usb 我的 何写一 文本 文件 | 更新日期: 2023-09-27 18:03:30
问题是,当我将智能手机连接到我在pc浏览器G3上看到的usb时,我没有看到像C: D: E: F: G:
这样的新驱动器号那么作为一个路径,我怎么知道在哪里写入文本文件?如何获得连接到usb的智能手机的闪存驱动器号?
我试过了:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO;
namespace Write_to_flash_drive
{
public partial class Form1 : Form
{
string pathtowrite = @"G3'Internal storage";
public Form1()
{
InitializeComponent();
StreamWriter w = new StreamWriter(pathtowrite + "''test.txt");
w.Write("test");
w.Close();
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
And got exception:
找不到路径的一部分'D:'C-Sharp'Write to闪存'Write to闪存'Write to闪存'bin'Debug'G3'Internal storage'test.txt'.
假设您的智能手机是LG G3,您必须在将其连接到usb端口时选择MTP协议:
Windows将分配给你一个字母,这样你就可以将字母设置为路径并写入文件,就像你在c#中所做的那样。示例