Skip to content

FileIO size() return an incorrect value (Arduino 1.5.7)  #2203

Closed
@guiyanakuang

Description

@guiyanakuang

Originally File.size() returns an unsigned long value, but the file size is larger than 32768, it will return an incorrect value.

#include <FileIO.h>
#include <Bridge.h>

void setup() {
  Bridge.begin();
  Serial.begin(9600);
  FileSystem.begin();
  while(!Serial); 
  File dataFile = FileSystem.open("/bin/busybox", FILE_READ);
  unsigned long len= dataFile.size();
  Serial.println(len);//return 26544
}

PuTTY
root@Arduino:/bin# ls busybox -l
-rwxr-xr-x 1 root root 419760 Apr 10 09:11 busybox

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions