Hi Keith,
If a file already exists, the file should be opened
instead of being created. Does the following code
automatically do that?

> > ------------------------------------------------
> > >FileHand out;
> > >Err errOpen;
> > >Err errClose;
> >     
> > >out = FileOpen(0, "MyApp.xml", 0, 0 ,
> > fileModeReadWrite | fileModeDontOverwrite,
> &errOpen);
> >    
> > >errClose = FileClose(out);
> > ------------------------------------------------

Do I need to make any modification to the above code
so that if the XML file already exists, just open it
instead of trying to create a new one with same name?

Thanks,
Rudra


--- Keith Rollin <[EMAIL PROTECTED]> wrote:
> After you create the file for the
> first time, it exists.  When you try to create it a
> second time, you get an error.  "errOpen" should
> hold some non-zero value, and "out" will probably
> hold garbage.  When you try to close the "file"
> indicated by this garbage, you crash.
> 
> -- Keith
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> >
>
[mailto:[EMAIL PROTECTED]
> Behalf Of Rudra
> > Sent: Friday, November 07, 2003 4:57 PM
> > To: Palm Developer Forum
> > Subject: Re: Writing an XML file from an
> application
> > 
> > 
> > Hi Al, 
> > This is what I am doing.
> > 
> > ------------------------------------------------
> > >FileHand out;
> > >Err errOpen;
> > >Err errClose;
> >     
> > >out = FileOpen(0, "MyApp.xml", 0, 0 ,
> > fileModeReadWrite | fileModeDontOverwrite,
> &errOpen);
> >    
> > >errClose = FileClose(out);
> > ------------------------------------------------
> > 
> > This code works fine the first time. If the same
> code
> > is called again the second time, I am getting this
> > error.
> > 
> > ----------------------------------------------
> > "MyApp just read from memory location 0x0003BEEE,
> > which is in an unallocated chunk of memory."
> > -----------------------------------------------
> > 
> > When I did a backtrace in PRC-Debugger, 
> > 
> > ---------------------------------------------
> > Program received signal SIGTRAP, Trace/breakpoint
> > trap.
> > 0x10c3ad72 in PrvValidateFileDescriptor ()
> > (gdb) backtrace
> > #0  0x10c3ad72 in PrvValidateFileDescriptor ()
> > #1  0x10c3acfa in PrvLockFileDescriptor ()
> > #2  0x10c3a064 in FileClose ()
> > #3  0x00048370 in StartApp () at MyApp.c:1206
> > #4  0x00047820 in MainFormHandleEvent (e=0x3d256)
> at
> > MyApp.c:686
> > #5  0x10c5c192 in PrvSendEventToForm ()
> > #6  0x10c5f4e2 in FrmDispatchEvent ()
> > #7  0x000472a6 in CheckOSVersion (bDisplayAlert=0
> > '\0') at MyApp.c:405
> > #8  0x00047080 in PilotMain (cmd=3,
> cmdPBP=0xd7c20000,
> > launchFlags=68)
> >     at MyApp.c:284
> > #9  0x10c0ea74 in PrvCallWithNewStack ()
> > #10 0x10c0e034 in SysAppLaunch ()
> > #11 0x10c934e0 in PrvAppLaunchLoop ()
> > #12 0x10c93156 in UIAppShellMain ()
> > #13 0x10c93628 in PilotMain ()
> > #14 0x10c93080 in __Startup__ ()
> > (gdb)
> > ----------------------------------------------
> > 
> > When I did a dir using Palm Debugger for the XML
> file,
> > 
> > ------------------------------------------------
> > name                    ID      total       data  
> > --------------------------------------------------
> >  TikTok.xml        000402DF    0.084 Kb    0.000
> Kb  
> >  TikTok.xml        000402DF    0.084 Kb    0.000
> Kb  
> >
>
------------------------------------------------------Total:
> > 2
> > --------------------------------------------------
> > 
> > Why is it showing two entries for the same file?
> > The error is coming when the FileClose() is called
> the
> > second time.
> 
> --
> For information on using the Palm Developer Forums,
> or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to