Shop OBEX P1 Docs P2 Docs Learn Events
Open two SD files at the same time? — Parallax Forums

Open two SD files at the same time?

RaymanRayman Posts: 14,223
edited 2008-01-05 03:58 in Propeller 1
I was just looking into opening two SD card files at the same time using Rockiki's SD object (or maybe·Mike Green's FemtoBasic version)...· I'd like to have one file open·for input·and another file for output...· (I just read a thread concerning this from several months ago)

I'm wondering if I can just store two copies of·the entire VAR section, one for each file and swap them in and out...· It appears to me (although I might be mistaken) that all the file info is stored there...

Anybody think this won't work?· Or, have a better idea?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-04 02:07
    The problem you run into is that some of the data for the directory and file allocation table is kept in the same area and you might have two copies of the same FAT data that get updated differently and then stored back on the SD card.· You're probably ok if you're only reading from multiple files.

    If· you can wait a week or two, I'm working on a version of Rokicki's FAT file system driver that supports multiple files (one per instance of the object) and works by sharing the directory / FAT information which is kept in a DAT section.· You'll be able to have several files open for reading or writing, just limited by space (about 600 bytes per file).· I'm trying to add a seek function as well so you can do random access for reading and for updating in place.
    ·
  • Paul BakerPaul Baker Posts: 6,351
    edited 2008-01-04 02:12
    That's great news Mike, aany chance it will support subdirectories as well?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-04 02:16
    Paul,
    I'll save that for the next iteration. I need the multiple open file capability for a project I'm working on, but I don't need the subdirectories for that. I'll keep it in mind though.
    Mike
  • Oldbitcollector (Jeff)Oldbitcollector (Jeff) Posts: 8,091
    edited 2008-01-04 03:38
    Second that request for subdirectories.....

    OBC

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    New to the Propeller?

    Getting started with the Protoboard? - Propeller Cookbook
    Got an SD card? - PropDOS
    A Living Propeller FAQ - The Propeller Wiki
    (Got the Knowledge? Got a Moment? Add something today!)

  • RaymanRayman Posts: 14,223
    edited 2008-01-04 14:03
    Mike: This is great news! I hope you get it working... Seek would also be nice.

    Wouldn't FAT data only get stored back for a write operation? I need one file for read and one for write, so I wouldn't think there'd be a conflict...
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-04 14:11
    Rayman,
    I was trying to be cautious. Yes, you should be ok with one write operation and any number of reads.
  • Ym2413aYm2413a Posts: 630
    edited 2008-01-05 03:58
    3rd request for subdirectories..... [noparse];)[/noparse]
    Would be useful!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Share the knowledge: propeller.wikispaces.com
    Lets make some music: www.andrewarsenault.com/hss

Sign In or Register to comment.