How to programatically format an SD card with FAT16?

前端 未结 6 1416
旧时难觅i
旧时难觅i 2020-12-10 20:47

I\'d like to initialize an SD card with FAT16 file system. Assuming that I have my SD reader on drive G:, how I can easily format it to FAT16 ?

UPDATE:

6条回答
  •  情书的邮戳
    2020-12-10 21:04

    Assuming you are actually asking how to do this in C# (from the tag you've applied to the question):

    I don't believe there is a framework way of formatting a drive, so you may have to fall back to something along the lines of

    ProcessStartInfo processStartInfo = new ProcessStartInfo();
    processStartInfo.FileName = "format";
    processStartInfo.Arguments ="/FS:FAT G:";
    Process.Start(processStartInfo);
    

    However, this is a pretty brittle way of doing this, and without parsing the output you may not be able to tell if this was successfull. I'd be cautious overall and ask yourself if you really want to allow a format from within your application.

提交回复
热议问题