Hi,

i hve asimple c++ prog written in vc++ editor.I am able to run this in my system when i deploy it in another system which doesn't hve vc++ environment its not working the exe just closes...

can anyone just tell me how to deploy the exe into another system.

is the build in debug mode creates a problem?


please help

thanks

For a simple C++ program you should be able to do it even when Visual Studio is not installed in the other machine. Since you have mentioned it as simple C++ program, I assume it is a console program and that you have forgotten to include a cin statement at the end of the program. This makes the output window to close immediately after it finished its operation.

you can also use

system("pause" );

statement before the return statement to make the program pause till you press a key.

you can also use

system("pause" );

statement before the return statement to make the program pause till you press a key.

I thought Ive read on several occasions that this should be avoided since it is bad programming :?:

I thought Ive read on several occasions that this should be avoided since it is bad programming

If that is true, accept my appologies. Why is it bad?

system() function takes a lot of time to execute. There are better ways to do that which do not use cmd.com (or command.com).

c++ -- cin.ignore() will wait for user input
 or cin.get()

c -- getchar()

Thanks a lot.

Or simply have the user go to a dos prompt before executing the program.

system() function takes a lot of time to execute.

So?

So?

system("cls") is non-standard and doesn't work across operating systems -- for examp unix uses system("clear"), and I suppose apple uses something else. If you want to write ANSI C or C++ then you must stay clear of system() function. But you can ignore that little detail when writing small example programs for yourself that you never indend for anyone else to see.

its not a win32 console app. with simple empty application...no not that...
i actually started this prog by selecting a C++ source filefrom files section in the wizard...later compiled the prog it asked tocreatethe workspace sodid taht... prog worked fine its in debug mode... as its a c++ source file the moment i created and built the prog its in debug mode...
wheni deploy it in another sys which doesn't have VS or any other .net or VC++ or vB installed.. its giving problemit just closes doen't give the o/p even i hve set the puse aslobut no luck plz help

Could you post your code so that we can see what are the dependencies, if there are any?

Could you post your code so that we can see what are the dependencies, if there are any?[/QUOTE]

this is the prog which I have written

#include<iostream.h>
#include<fstream.h>
#include<string.h>
#include<stdlib.h>


void main()
{


    char str[8000];
    char *delemeter=NULL;
    char *str2;
    int strlen1;
    int fileflag=0;
    char *filename;
    char in_file[50];
    int flag=0;
    char ext[6]=" ";
    long count=0;
    long size;
    long line=0;



    fstream file_in;
    fstream file_out;

    //get the input file 
    cout<<"Please enter the filename:  ";
    cin>>in_file;
    file_in.open(in_file,ios::in);

        //get the extension
    cout<<"Please enter the extension:  ";
    cin>>ext;

    cout<<endl<<"Processing file: "<<in_file<<endl;
while(!file_in.eof())
{

    //thiscode for collecting the String from the file
        file_in.getline(str,8000);
        str2=str;
        filename=" ";
        strlen1=strlen(str);

        //Checking for the delemeter 
        delemeter=strstr(str,"./ ADD NAME");

    //getting the file name and creating the file
    if(delemeter)
    {

        if((flag )&& (fileflag))
        {
            file_out.close();
            fileflag=0;
            filename=" ";
            flag=0;
        }
            if(strlen1!=0) 
            {
            //cout<<" string has somevalue"<<endl;
                delemeter=" ";

               while(*str2 !='/n')
                {
                  while(*str2!='=')
                  {
                     str2++;
                     strlen1--;
                  }
                  filename=strstr(str2,"=");
                  filename++;
                  filename=strtok(filename," ");
                  strcat(filename,ext);
                     break;             
                }
            strlen1--;

            }

        //creating file with this name
            if(fileflag==0)
            {
                file_out.open(filename,ios::out);
                count++;
                fileflag=1;
            }

            flag++;
        continue;
    }
    else
    {
        file_out<<str<<endl;
    }
}

cout<<"No of files created:  "<<count<<endl;

}

Add the following code at the end of your main function.

cout << "Press any key to continue" << endl;
cin.ignore(2);

This link was posted in a previous thread and it has some other methods, that maybe better than this, so take a look at it.

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.