I have written a program that must copy himself in a directory, but i can't know the path in which it will be executed, so i need to know this. How can i do??
I have written a program that must copy himself in a directory, but i can't know the path in which it will be executed, so i need to know this. How can i do??
Programs that copy themselves are usually suspect... There's no reason to do that except to prevent deletion.
In any case, look at how main() works in your C textbooks...
I need that the program starts when windows starts, so i need that the program is in the correct position, else it couldn't be executed. It's not a suspicios thing. But I'll try to find something.
By Windows standards ALL programs reside in c:\program files on 32 bit systems, or in either c:\program files or c:\program files (x86) for 64 bit systems.
To make a program start with windows you make a shortcut to the program in the user's start menu\programs\startup...
You don't make copies of your programs in different places on the system.
If you want to do this correctly use an install builder such as Inno Setup (yes that's a link, click on it!) which provides full installation and uninstall capability as well as many features for initial setup.
The one thing you never NEVER do is install anything on a user's system they don't know about.
Last edited by CommonTater; 08-11-2011 at 06:06 AM.
OK, so first you ask about keeping track of keystrokes and now this. May I suggest you explain yourself a lot more clearly about what it is you are trying to accomplish if you want to get help. If English is a barrier, post your code and just try to explain that. We all speak "C" here, and for some *cough*quzah*cough* it was their first language.
It's called your current or present working directory, abbr. PWD or CWD, and there are OS specific routines to get it.
Of course, you can't be sure the directory it is executed in is also the directory where the executable is stored on disk. In that case, you can use argv[0] to determine the path it was called with, and if that is a relative path combine it with the PWD.
If it was executed with no path, then it is in the "executable path" of the OS, and you will have to search for it there. At the very least, arg[0] will give you the executable name to work with.
C programming resources:
GNU C Function and Macro Index -- glibc reference manual
The C Book -- nice online learner guide
Current ISO draft standard
CCAN -- new CPAN like open source library repository
3 (different) GNU debugger tutorials: #1 -- #2 -- #3
cpwiki -- our wiki on sourceforge
Haha....you mean like his ftp thread?
Usually my interest gets peaked when I see:
(1) Low post count
(2) Lack of a concise question
(3) No code provided
Now where is V when we need him to post his 8-bit com hackery?
It's not a malicious thing. The topics that i made are all for different aims. I'm not trying to create a keylogger, there are too many of them on the net. The FTP post was to upload files immediately without installing a client, and also to learn something about FTP, the topic about GetAsyncKeyState was to create a menu that receives controls from the keyboard, and this topic is to install a simple program, and CommonTater is right, i can use InnoSetup.
Be honest now... if the situation was reversed... If I had a posting history that might tell a story and I offered you that line of BS....
Would you believe me?