Pelles C forum

C language => Pocket PC and Smartphone questions => Topic started by: joerg on February 12, 2007, 10:40:14 pm

Title: how get the current directory
Post by: joerg on February 12, 2007, 10:40:14 pm
My problem is to find a function, that give me the current directory on PocketPC.

The C-function getcwd() is not defined for WINCE, and by using the API-Function GetCurrentDirectory I get a linker error "unresolved external GetCurrentDirectoryW"  :?
And the Commandline of WinMain is empty.

I want to read a INI-File that is stored in the EXE-Dir. But a call for wfopen without a path give me a NULL Handle.

Does anybody know, what else can I do

Thanks
  Joerg
Title: how get the current directory
Post by: Stefan Pendl on February 12, 2007, 11:32:06 pm
You may check GetModuleFileName at http://msdn2.microsoft.com/en-us/library/ms908441.aspx
Title: how get the current directory
Post by: Pelle on February 13, 2007, 10:52:46 am
As Microsoft puts it: "Windows CE does not use the current directory concept. Instead, all of the references to an object are given in the full path".
Title: how get the current directory
Post by: joerg on February 13, 2007, 11:26:56 am
Yes I read it yesterday night , that CE don't have a current directory.


I have an EXE and I want to put it in any directory. In the same dirictory is the coresporending ini-file.
Now I want to read this Ini-File, but I found no way to get the directory, from which my EXE started.
In normaly C I can read this info from argv[0].

One solution  is, to store the Path in the registry.  :( But other programms, I have installed, can read there INI's, without using the registry  :|
Title: how get the current directory
Post by: Stefan Pendl on February 13, 2007, 11:45:48 am
Quote from: "joerg"
I have an EXE and I want to put it in any directory. In the same dirictory is the coresporending ini-file.
Now I want to read this Ini-File, but I found no way to get the directory, from which my EXE started.

Use GetModuleFileName to get the full path to the EXE.
Set the handle to NULL and this function will return the full path to your EXE.
Title: how get the current directory
Post by: joerg on February 13, 2007, 12:05:30 pm
@Stefan

thanks, I will try it  :D
Title: how get the current directory
Post by: joerg on February 13, 2007, 12:14:33 pm
@Stefan

 =D> Thank you ... it works  :)

The Api-Doc tells about DLL only, but it seems, that the doc is wrong at this point.
Title: how get the current directory
Post by: Stefan Pendl on February 13, 2007, 11:26:25 pm
Quote from: "joerg"
The Api-Doc tells about DLL only, but it seems, that the doc is wrong at this point.

I think the doc is just missing that an EXE is an executable too.

I checked the "Server 2003 SDK" and it says executable file.
I had to check MSDN to be sure it was supported on WinCE and it is since v2.0.
Title: Re: how get the current directory
Post by: Jacqueline on January 01, 2015, 06:20:52 am
thanks a lot i think this is the thin i couldn t find!!
i will spend my time with it and hope me to check it ;)
Title: Re: how get the current directory
Post by: Bitbeisser on January 03, 2015, 04:10:33 am
thanks a lot i think this is the thin i couldn t find!!
i will spend my time with it and hope me to check it ;)
ICU! ;)
Title: Re: how get the current directory
Post by: jj2007 on January 03, 2015, 10:35:42 am
Ralf,

Any idea what these bots want? There used to be a species that embedded links to shops in their posts for raising google hits, but the last two just repeat earlier posts without such links. What do they gain by posting here??
Title: Re: how get the current directory
Post by: frankie on January 03, 2015, 02:57:49 pm
Ralf,

Any idea what these bots want? There used to be a species that embedded links to shops in their posts for raising google hits, but the last two just repeat earlier posts without such links. What do they gain by posting here??
At least a couple.
They check how the forum control is effective, and what's the traffic.
Title: Re: how get the current directory
Post by: Bitbeisser on January 05, 2015, 04:23:18 am
Ralf,

Any idea what these bots want?
Gaining a foothold...
Quote
There used to be a species that embedded links to shops in their posts for raising google hits, but the last two just repeat earlier posts without such links. What do they gain by posting here??
Most of these have a kind of dummy signature, without a actual link when they sign up. Then they post what seems an harmless post into an existing thread, with a more or less matching contents. This is to get past the initial forum moderation that is in some forums in place, where the first (few) post(s) of a new signup needs to have moderator approval. They rely here on the fact that in a lot of forum software this moderator approval page does not show the whole thread, so a harmless reply, somehow on topic to the subject line might get them past this point.
And once they have a foothold, they change the signature to link to spam sites and/or start to spew whole messages with spam.

Just doesn't work here  ;)

And those aren't bots, those are real-live "string puppets", therefor bypassing all those more or less fancy "gotchas" that are aimed at preventing real bots to sign up and post...

Ralf