I have in my code in c, this function:

    fseek(file, 0, SEEK_SET);

I need to use the same function with Arduino ide. Is this correct?


Or what is the alternative function in Arduino ide?

  • 1
    – Juraj
    Jul 27, 2023 at 8:12
  • 2
    Just try it and see what happens. That will be way faster than asking.
    – Delta_G
    Jul 27, 2023 at 15:17
  • It can be faster to look up the documentation than wait hours for someone to answer.
    – Nick Gammon
    Jul 28, 2023 at 1:29
  • OT, to clarify technical terms: The Arduino IDE is just that, an integrated development environment. It does not provide functions or classes, it just recognizes the names and therefore give you some support. The real thing you mean are the Arduino libraries, the reference of which you should bookmark in your browser. However, an installation puts all of this on your computer. (There is more, for example the compiler system...) You can use each without the other. Jul 28, 2023 at 6:18

1 Answer 1


According to https://www.arduino.cc/reference/en/libraries/sd/seek/ :

SD - seek()

Seek to a new position in the file, which must be between 0 and the size of the file (inclusive).




  • file: an instance of the File class (returned by SD.open()).
  • pos: the position to which to seek (unsigned long).

If you want to seek to the start of the file, therefore you should seek to zero, not file.size(). Using file.size() would seek to the end of the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.