CASLSoft.com

Welcome to the CASL Support board

[ Home ] [ News ] [ Community ] [ Products ] [ Download ] [ Support ] [ Sales ] [ About CASL ]

It is currently Thu Sep 09, 2010 7:25 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: External SD cards
PostPosted: Thu Aug 13, 2009 1:51 am 
Offline
Knight of CASL

Joined: Mon Nov 14, 2005 4:49 pm
Posts: 21
Location: Australia
Is it possible from within CASL code to address an external SD card?

I need the functionality of automatically creating critical file backups from the shutdown procedure for possible resurrection in the event of battery failure (and no access to a base PC).
Although it might be time-consuming I'm prepared to do a line-for-line copy because the files are not that big. Searching these boards has proved fruitless but I guess what I'm asking is if there's an equivalent of Uli's Palm SD card file utility for the PPC.


Top
 Profile  
 
 Post subject: Re: External SD cards
PostPosted: Thu Aug 13, 2009 6:26 am 
Offline
CASL Jedi
User avatar

Joined: Mon Oct 24, 2005 4:28 pm
Posts: 1286
Location: CASL user/lover since 2000. Location: Arkansas, USA, Earth, Solar System, Milky Way, Universe
Since the PPC uses paths much like a desktop, I'd think accessing the card would just involve knowing the path to the card.

From what I see, though, different devices may use different names for the card path, so you might have to use if/else to test for where each device's card is.

What comes to mind is to try creating a file on the SD card, then test to see if it exists. If you create the file, then can find it, you have a valid path. If you can't find it, that path doesn't exist on the device. Some different paths I know of that different devices use for the SD card are "\Storage Card", "\SafeStore", and "\SD Card".

I haven't tested the code below, but something similar to this might help you find the path to the SD card on many devices.
Code:
variables;
   string path;
end;
file testfile; end;

function findpath;
   open testfile,"\Storage Card\Program Files\myfile";
   if exists(\Storage Card\Program Files\myfile");
      path="\Storage Card\Program Files\\";
   else;
      open testfile,"\SafeStore\Program Files\myfile";
      if exists(\SafeStore\Program Files\myfile");
         path="\SafeStore\Program Files\\";
      else;
         open testfile,"\SD Card\Program Files\myfile";
         if exists(\SD Card\Program Files\myfile");
            path="\SD Card\Program Files\\";
         end_if;
      end_if;
   end_if;
end;

_________________
Patrick Carroll
Arkansoft Software

_______________________________________
"When life gives you lemons, make limoncello. "


Top
 Profile  
 
 Post subject: Re: External SD cards
PostPosted: Mon Jun 21, 2010 6:41 am 
Offline
Knight of CASL

Joined: Mon Nov 14, 2005 4:49 pm
Posts: 21
Location: Australia
I thought I was onto it and the logic in the sample code is impeccable (apart from needing \\ everywhere instead of \).
It does not work, however. It always returns true even with a junk non-existant file on the card.
Ignoring that issue, a simple program to then loop through a database file takes its time to step through it record by record and always returns errorcode zero until reaching the proper -5 end of file on input and does not raise any errors on the insert statements on a file opened on \Storage Card. The resultant file dissapears into thin air.
Why is it so hard to simply get a program to copy a file to a card like this?
Why is it so hard indeed to find information on how to copy ANYTHING to an SD card with only the device in your hand and no connection to a PC?

I can understand now that if it's a historical CASL limitiation that will only open a file within the device's hidden storage area where prying eyes can't get to it, that any program trying to open a file on an external card is doomed to failure.

Some posts here imply that copying files is so simple that the method to do so is so trivial that it's not even worth mentioning. It seems to be an operating system constraint that one is not supposed to know where user data is stored in order that you can click on a file, copy it, open another folder and paste it in there! I'm an application programmer not a systems programmer so a basic omission like this seems unjustified.

Uli's librarys are only of use with a Palm and not a PPC so they can't help. Using an SD card as a logical form of backup for user data is turning out to be an exercise in total frustration yet again! Will CASL 4.4 help here?!


Top
 Profile  
 
 Post subject: Re: External SD cards
PostPosted: Fri Jul 09, 2010 4:10 pm 
Offline
Knight of CASL

Joined: Mon Nov 14, 2005 4:49 pm
Posts: 21
Location: Australia
Update!
Persistance has paid off and attempts to use the SD card for external backup/restore have been successful!
The secret is to not attempt to use program logic to write to a DATABASE file but to a simple text file instead! It's pretty quick to write to the card also. Each record needs to be written with CRLF character pair at the end of each record. Because nearly all my files are simplified to a single key field and a data field, it's a simple matter to make a parameterized procedure handle a series of files to be backed up or restored.
Using my HP Ipaq 5550 the folder name prefix is "\Storage Card\". Of course, this might be different on other models.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group