Is there a specific function in C++ to install/assign a file in a directory?
And if t here is are there any limitations to what it can distribute?
Are installation in multiple directories possible?

Thanks , and I hope to see the responses.

Recommended Answers

All 14 Replies

do you mean something like Install Shield ?

If you wrote the programs yourself, then there is probably few if any limitations as to what you can distribute. But you may have to also install other DLLs or shared libraries that your program(s) depend on. For those you have to consult the author's license.

Member Avatar for iamthwee

do you mean something like Install Shield ?

If you wrote the programs yourself, then there is probably few if any limitations as to what you can distribute. But you may have to also install other DLLs or shared libraries that your program(s) depend on. For those you have to consult the author's license.

Sorrie to hijack this, but is that free, and would that work for java type applications/ on various operating systems?

I don't think it is free -- read the link and you will find out. You can google for "install programs" and maybe find others, such as this one

Member Avatar for iamthwee

I don't think it is free -- read the link and you will find out. You can google for "install programs" and maybe find others, such as this one

Ahh, well couldn't you do it a quick and dirty way, like creating a directory, then copying the files you wish to distribute into that directory in binary format?

I think there is a command called makedir_ or something like dat?

Ahh, well couldn't you do it a quick and dirty way, like creating a directory, then copying the files you wish to distribute into that directory in binary format?

I think there is a command called makedir_ or something like dat?

For very simple programs, yes that is probably the best and easiest way. Large applications are not so easy and require lots of checks and tests. Ever hear of "DLL HELL!" -- making sure the dlls or shared libraries you want to install are not older than those that are already on the computer.

Member Avatar for iamthwee

For very simple programs, yes that is probably the best and easiest way. Large applications are not so easy and require lots of checks and tests. Ever hear of "DLL HELL!" -- making sure the dlls or shared libraries you want to install are not older than those that are already on the computer.

Oh I see... shame you have to purchase that install shield tho. I might try and crack it later. Heh heh (joke).

look around goodle and you might find a shareware version for little or no cost. Microsoft Installer may also be free (I don't know a thing about it).

Alright thanks for the info. Instead of making a new directory can it also be placed in an existing one.

Member Avatar for iamthwee

Alright thanks for the info. Instead of making a new directory can it also be placed in an existing one.

Yes of course, what Operating system are you using and what compiler...or IDE?

Alright thanks for the info. Instead of making a new directory can it also be placed in an existing one.

well maybe yes, and maybe no. The user must have write permissions in the directory. But that is also true if a new folder is created. And that is why most installers require the user to be logged in with an account that has (MS-Windows) administrative privaledges or on *nix with root privaledges.

I am running windows XP special Pack 2 and I use Dev C++ Compiler.

Let me clear things up a bit. I am making a scanner and I want it to save a logfile in the Documents/My Games folder.

What is the code line or snippet to specify that directory?

Member Avatar for iamthwee

Here's the code to create a directory (it should work for Dev although I can't be sure):

#include <direct.h>
#include <iostream> 
int main( ) 

{ 
  
    _mkdir( "c:/iamthwee" ); 
  
    std::cout<<"YAY directory created";
      //To remove the directory use _rmdir
         
  
   std::cin.get();
   return 0; 
}

The following code writes a text file to the directory and path you specify:

#include <iostream>
#include <fstream>

using namespace std;

int main()
{
    ofstream crap("c:/Documents and Settings/burp.txt");
    crap<<"Ye fool";
    
    crap.close();
    cin.get();
    return 0;
}

Hope this helps :-)

Thanks that helped a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.