Create a file in the path of a PDA

Hi,

I am working with the application of user interface where the code has
to be run on the device(i.e. PDA  of imate, Jasjar) using Active Sync.

Now I have to create a file config.txt using the API  _wfopen , with a
path given as
/My Device/Program Files/config.txt in the PDA.

I tried doing as

FILE *fp;
 if ( (fp = _wfopen( L"//My Device//My Program Files//Config.txt",L"w")
) == NULL )
{
         	AfxMessageBox(_T("Couldn't Create the file !"));
		return FALSE;
}

But it is not creating the file as the path specified, it is giving
Couldn't Create the file !
i.e. _wfopen is getting failed.

But if give
fp  =  _wfopen( L"Config.txt",L"w") ;
It works, but the file is created at /My Device  of the PDA.

Can you tell me how to create a file in the path
 //My Device//My Program Files//Config.txt of the PDA.

0
1/23/2007 9:05:30 AM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
652 Views

Similar Articles

[PageSpeed] 2

>Now I have to create a file config.txt using the API  _wfopen , with a
>path given as
>/My Device/Program Files/config.txt in the PDA.
>
>I tried doing as
>
>FILE *fp;
> if ( (fp = _wfopen( L"//My Device//My Program Files//Config.txt",L"w")
>) == NULL )
>{
>         	AfxMessageBox(_T("Couldn't Create the file !"));
>		return FALSE;
>}
>
>But it is not creating the file as the path specified, it is giving
>Couldn't Create the file !

When it fails, what does the result of GetLastError tell you the
problem is?

Dave
0
davidl7375 (2060)
1/23/2007 10:10:39 AM

On Jan 23, 3:10 pm, David Lowndes <Dav...@example.invalid> wrote:
> >Now I have to create a file config.txt using the API  _wfopen , with a
> >path given as
> >/My Device/Program Files/config.txt in the PDA.
>
> >I tried doing as
>
> >FILE *fp;
> > if ( (fp = _wfopen( L"//My Device//My Program Files//Config.txt",L"w")
> >) == NULL )
> >{
> >            AfxMessageBox(_T("Couldn't Create the file !"));
> >            return FALSE;
> >}
>
> >But it is not creating the file as the path specified, it is giving
> >Couldn't Create the file !When it fails, what does the result of GetLastError tell you the
> problem is?
>
> Dave


Ya , i inserted this line ,   DWORD dw = GetLastError();
It gave dw = 1222.

What does it mean.

0
1/23/2007 10:38:26 AM
>Ya , i inserted this line ,   DWORD dw = GetLastError();
>It gave dw = 1222.
>
>What does it mean.

Use the Error Lookup Tool in the VS IDE. It'll show you that the value
means: "The network is not present or not started."
Alternatively, use the IDE debugger ERR,hr pseudo register to
automatically see the value of GetLastError.

My conclusion would be that is not the correct way to specify the path
- but I've not done any PDA development so I don't know for sure what
is correct.

Dave
0
davidl7375 (2060)
1/23/2007 8:27:33 PM
Reply:

Similar Artilces: