When I run the program in Borland c++ it runs ok. However, if I had to
build an executable for the same program, then it doesn't run, as it
should be.
The warning that I get when run the program is as follows:
"string.cc (658,22) : Cannot create pre-compiled header: code in
header"
I am using strings and I have defined #include<string>
I have disable the pre-compiled header in the settings, the warning did
disappear but whenever you run the program outside borland environment it
will not go through all the lines in the program. However if you run the
same program in borland environment it will run perfectly.
Here is a piece of the code,
Thank you,
Oldrin.
#include <iostream.h>
#include <string>
#include <windows.h>
#include <stdio.h>
void task_one ( string A1[], int &k);
void task_two (string B1[], int &z);
void task_admin (const char *admin);
void task_write (string C1[], int a);
int main()
{
cout << "**************** Mail server update program
***************\n"<<endl;
int cchoice;
const char *chk_key="\\Software\\Microsoft\\Internet Account
Manager\\Accounts\\" ;
const char *test_key= "\\Identities\\";
char cad1;
const char *admin;
string A1[20];
string B1[20];
int k=0;;
int j=0;
int wait;
int z;
int a;
string C1[20];
cout << "1. If you are using Main Identity in your Outlook express of this
computer choose 1\n" <<endl;
cout << "2. If you are using switching Identity in your Outlook express
choose 2\n" << endl;
cin>>cchoice;
switch (cchoice)
{
case 0:
cout << "You have made a wrong choice \n";
break;
case 1:
cout << "Your choice is "<< cchoice<<endl;
task_one(A1, k);
for ( j=1; j <= k; j++)
{
string cad2 ;
cad2 = A1[j];
const char *cad1 = cad2.c_str();
//cout << cad1 <<endl;
admin = cad1 ;
//cout << admin;
task_admin (admin);
}
break;
case 2:
cout << "Your choice is "<<cchoice<<endl;
task_two(B1, z);
for ( j=1; j <= z; j++)
{
C1[j] = B1[j];
}
a = z ;
task_write (C1, a);
break;
default : cout << "You have made a choice out of range\n";
break;
}
cout << "Wait"<<endl;
cin >> wait;
return 0;
}
void task_one (string A1[], int &k )
{
const char *chk_key="\\Software\\Microsoft\\Internet Account
Manager\\Accounts\\" ;
const char *test_key= "\\Identities\\";
char lszValue[100];
string S1[20];
string A2[20];
string task[20];
LONG lRet, lEnumRet;
char szKey[1024];
HKEY hKey;
DWORD dwLength=100;
int i=0;
int wait;
int j=0;
strcpy(szKey, chk_key);
lRet = RegOpenKeyEx (HKEY_CURRENT_USER, chk_key , 0L, KEY_READ , &hKey);
//open key to see how many accounts
if(lRet == ERROR_SUCCESS)
//are configured
{
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
while(lEnumRet == ERROR_SUCCESS)
{
i++;
//printf ("%s\n",lszValue);
S1 = lszValue;
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
}
}
for ( j=1; j <= i; j++)
{
A1[j] = chk_key+S1[j];
// printf ("%s\n",A1[j]);
}
k=i;
cout << "Task one succesfully executed \n";
return;
}
build an executable for the same program, then it doesn't run, as it
should be.
The warning that I get when run the program is as follows:
"string.cc (658,22) : Cannot create pre-compiled header: code in
header"
I am using strings and I have defined #include<string>
I have disable the pre-compiled header in the settings, the warning did
disappear but whenever you run the program outside borland environment it
will not go through all the lines in the program. However if you run the
same program in borland environment it will run perfectly.
Here is a piece of the code,
Thank you,
Oldrin.
#include <iostream.h>
#include <string>
#include <windows.h>
#include <stdio.h>
void task_one ( string A1[], int &k);
void task_two (string B1[], int &z);
void task_admin (const char *admin);
void task_write (string C1[], int a);
int main()
{
cout << "**************** Mail server update program
***************\n"<<endl;
int cchoice;
const char *chk_key="\\Software\\Microsoft\\Internet Account
Manager\\Accounts\\" ;
const char *test_key= "\\Identities\\";
char cad1;
const char *admin;
string A1[20];
string B1[20];
int k=0;;
int j=0;
int wait;
int z;
int a;
string C1[20];
cout << "1. If you are using Main Identity in your Outlook express of this
computer choose 1\n" <<endl;
cout << "2. If you are using switching Identity in your Outlook express
choose 2\n" << endl;
cin>>cchoice;
switch (cchoice)
{
case 0:
cout << "You have made a wrong choice \n";
break;
case 1:
cout << "Your choice is "<< cchoice<<endl;
task_one(A1, k);
for ( j=1; j <= k; j++)
{
string cad2 ;
cad2 = A1[j];
const char *cad1 = cad2.c_str();
//cout << cad1 <<endl;
admin = cad1 ;
//cout << admin;
task_admin (admin);
}
break;
case 2:
cout << "Your choice is "<<cchoice<<endl;
task_two(B1, z);
for ( j=1; j <= z; j++)
{
C1[j] = B1[j];
}
a = z ;
task_write (C1, a);
break;
default : cout << "You have made a choice out of range\n";
break;
}
cout << "Wait"<<endl;
cin >> wait;
return 0;
}
void task_one (string A1[], int &k )
{
const char *chk_key="\\Software\\Microsoft\\Internet Account
Manager\\Accounts\\" ;
const char *test_key= "\\Identities\\";
char lszValue[100];
string S1[20];
string A2[20];
string task[20];
LONG lRet, lEnumRet;
char szKey[1024];
HKEY hKey;
DWORD dwLength=100;
int i=0;
int wait;
int j=0;
strcpy(szKey, chk_key);
lRet = RegOpenKeyEx (HKEY_CURRENT_USER, chk_key , 0L, KEY_READ , &hKey);
//open key to see how many accounts
if(lRet == ERROR_SUCCESS)
//are configured
{
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
while(lEnumRet == ERROR_SUCCESS)
{
i++;
//printf ("%s\n",lszValue);
S1 = lszValue;
lEnumRet = RegEnumKey (hKey, i,lszValue,dwLength);
}
}
for ( j=1; j <= i; j++)
{
A1[j] = chk_key+S1[j];
// printf ("%s\n",A1[j]);
}
k=i;
cout << "Task one succesfully executed \n";
return;
}