SD Filenames


i keep getting errors when use sd.mkdir. code:
code: [select]
if(char(serialreceived) == '\n') {
        serial.print("mkdir: ");
        serial.println(serialcommand);
        serial.println(serialcommand.length());
        char sen[serialcommand.length()+1];
        for(int = 0; < serialcommand.length(); i++) {
          sen[i] = serialcommand.charat(i);
        }
        if(sd.mkdir(sen)) {
          serial.write(6);
        } else {
          serial.write(21);
        }
        serialstate = 0;
        serialcommand = "";
      } else {
        serialcommand += char(serialreceived);
      }


when run code, sd.mkdir(sen) returns false.

you need store null @ end of string. try this:
code: [select]

        int i;
        for(i = 0; < serialcommand.length(); i++) {
          sen[i] = serialcommand.charat(i);
        }
        sen[i] = 0;


you should make sure names use valid.
pete


Arduino Forum > Using Arduino > Storage > SD Filenames


arduino

Comments

Popular posts from this blog

Connecting Raspberry Pi 2 to P10(1R)-V706 LED Dot Matrix - Raspberry Pi Forums

TypeError: <unknown> is not a numpy array - Raspberry Pi Forums

datso and removing imagetitle - Joomla! Forum - community, help and support