Hi,

can someone give me an example how to open and write Files, please? I tried the examples on this site: http://prizm.cemetech.net/index.php/Using_the_File_System but they didn't work.

And please answere in simple english because english is not my mainlanguage.
Can you tell us more about how they didn't work, Py-Prog? What happened when you tried to use the examples on that page? Code that you tried inside [code] tags would also help.
I can't compile it, but the code is an example from the wiki.


Code:
#define CREATEMODE_FILE 1
#define CREATEMODE_FOLDER 5
#define READ 0
#define READ_SHARE 1
#define WRITE 2
#define READWRITE 3
#define READWRITE_SHARE 4
// These aren't in the PrizmSDK, but they are easier to remember.
#define FILE_PATH "\\\\fls0\\File.txt"

unsigned short pFile[sizeof(FILE_PATH)*2]; // Make buffer
int hFile;

Bfile_StrToName_ncpy(pFile, (unsigned char*)FILE_PATH, sizeof(FILE_PATH));
hFile = Bfile_OpenFile_OS(pFile, READWRITE); // Get handle

if(hFile < 0) // Check if it opened
{
  int size = 256;
  if(Bfile_CreateEntry_OS(pFile, CREATEMODE_FILE, &size) >= 0) // Did it create?
  {
    hFile = Bfile_OpenFile_OS(pFile, READWRITE);
    if(hFile < 0) // Still failing?
    {
      // Die with a fatal error
      // This shouldn't happen
    }
  }
  else
  {
    // Die with a fatal error
    // This shouldn't happen
  }
}

[/code]
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
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 vote in polls in this forum

 

Advertisement