Heya , I was thinking of making a site opener application :). But I had a lots of problems . The next problem is facing this , it just crashes.:(
What do I want my program to do ?
I want to assign a nickname for each of my favorite website's .
I will do that using an external file "data" , there the nickname & the website will be found .
What does my current code do?
It just crashes out :@, I think the problem is the char declaration , I never figured that out , even so i read a lot of websites .

Code :

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

using namespace std;

fstream fin("data",ios::in);

char *web_adress[10000],*web_nick[10000],*searching;
char order[1];
int i,run=1,last_web;
int main(){
cout<<"Welcome to Robye's fast open page program , please wait while program is loading"<<endl;
for(cin>>i;i;i--){fin>>web_nick[i]>>web_adress[i];}
last_web=i;
cout<<"Loading Complete"<<endl;
cout<<"Tipe 'h' if you're using this for the first time"<<endl;
do {
cin>>order[1];
switch (order[1]) {
case 'h' : cout<<"You have 2 basic commands : 'o' 'e' 'c'\n'open' - Open the Website\n'edit' - Edit the database\n'close' - Closes this application\n";break;
case 'o' : cout<<"Open site ";cin>>searching;
for(i=1;i<=last_web && i>0;i++){
if(web_nick[i]==searching){ShellExecute(NULL, "open", web_adress[i] ,NULL, NULL, SW_SHOWNORMAL);i=0;}
}
if(i!=0)cout<<"Page / Nickname wrong , use the 'edit' section";
if(i==0)cout<<"Page successfully loaded , Have a Nice Day !";
break;
case 'c' : cout<<"Program Closed ";run=0;break;
default : cout<<"Couldn't Find : " << order ; break ;

}

}while(run);

fin.close();
}
//ShellExecute(NULL, "open", "http://google.com",NULL, NULL, SW_SHOWNORMAL);

Data :

2
string http://www.cplusplus.com/reference/string/string/
google http://www.google.ro

Hope someone can figure out what i did wrong , thanks for trying to help :)

Please format your code. It is really difficult to read and follow.

Because I can't read the code, I'll make a guess. You are defining an array of pointers, and attempting to stuff data into the pointers. But there is no data space defined. Just pointers. That will cause your problem.

/sigh , sorry don't really know how that happened

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

using namespace std;

fstream fin("data",ios::in);

char *web_adress[10000],*web_nick[10000],*searching;
char order[1];
int i,run=1,last_web;
int main(){
    cout<<"Welcome to Robye's fast open page program , please wait while program is loading"<<endl;
    for(cin>>i;i;i--){fin>>web_nick[i]>>web_adress[i];}
    last_web=i;
    cout<<"Loading Complete"<<endl;
    cout<<"Tipe 'h' if you're using this for the first time"<<endl;
    do {
    cin>>order[1];
    switch (order[1]) {
           case 'h' : cout<<"You have 2 basic commands : 'o' 'e' 'c'\n'open' - Open the Website\n'edit' - Edit the database\n'close' - Closes this application\n";break;
           case 'o' : cout<<"Open site ";cin>>searching;
                             for(i=1;i<=last_web && i>0;i++){
                                    if(web_nick[i]==searching){ShellExecute(NULL, "open", web_adress[i] ,NULL, NULL, SW_SHOWNORMAL);i=0;}
                             }
                             if(i!=0)cout<<"Page / Nickname wrong , use the 'edit' section";
                             if(i==0)cout<<"Page successfully loaded , Have a Nice Day !";
                             break;
           case 'c' : cout<<"Program Closed ";run=0;break;
           default : cout<<"Couldn't Find : " << order ; break ;

            }

    }while(run);

fin.close();
}
//ShellExecute(NULL, "open", "http://dreamincode.net",NULL, NULL, SW_SHOWNORMAL);

can any1 give me a tip ..?

can any1 give me a tip ..?

Sure. Explain exactly what happens and what should have happened. Tell us where the problem is so we have an idea where to look.

In general, if you want help, explain in detail what the problem is. Don't leave it to us to figure what's happening. Tell us.

Heya , I was thinking of making a site opener application . But I had a lots of problems . The next problem is facing this , it just crashes.
What do I want my program to do ?
I want to assign a nickname for each of my favorite website's .
I will do that using an external file "data" , there the nickname & the website will be found .
What does my current code do?
It just crashes out , I think the problem is the char declaration , I never figured that out , even so i read a lot of websites .

Wasn't this enough ?

anyway i figured it out

Maybe someone is interested in doing the same thing , or wants to use it so here it is :
Edition 1

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

using namespace std;

fstream fin("data.txt",ios::in);

char web_adress[10000][100],web_nick[10000][100],searching[200];
char order[100];
int i,run=1,last_web,k,case_detect;

int main(){
    cout<<"Welcome to Robye's fast open page program , please wait while program is loading";
    for(fin>>i,last_web=i;i;i--){fin>>web_nick[i];fin>>web_adress[i];fin.get();}
    cout<<"Loaded "<<last_web<<" fast open task"<<endl;
    do {
    cout<<"Order : ";
    cin>>order;
    if(!stricmp(order,"beta") case_detect = 1;
    if(!stricmp(order,"open") case_detect = 2;
    if(!stricmp(order,"open") case_detect = 3;
    switch (case_detect) {
           case 1 : for (i=1;i<=10;i++){cout<<web_nick[i]<<" "<<web_adress[i]<<endl;}break;
           case 2 : cout<<"Open : ";cin>>searching;
                             for(i=1;i<=last_web && i>0;i++){
                                    if(strcmp(web_nick[i],searching)==0){
                                    k=i;i=-1;
                                        ShellExecute(NULL, "open", web_adress[k] ,NULL, NULL, SW_SHOWNORMAL);
                                        }
                             }
                             if(i==0 || i==1 || i==-1)cout<<"Done"<<endl;
                              else cout<<"Adress / Nickname wrong , use the 'data' section"<<endl;
                             break;
           case 3 : run=0;break;
           default : cout<<"Couldn't Find : " << order <<endl; break ;

            }

    }while(run);
fin.close();
}

Edition 2

#include <iostream>
#include <fstream>
#include <windows.h>
#include <string>
using namespace std;

char cmdtype[3],cmd[1000],ex[1000],order[3];
char alias[1000][100][100];
int she,i,mact,macl,i2;

int alias_ex(char trac[3]){
    int i,ict;
    for(i=1;i<=mact;i++){
        if(stricmp(cmd,alias[i][0])==0){
           for(ict=1;alias[i][ict]!="end";ict++){
               ShellExecute(NULL, "open", alias[i][ict] ,NULL, NULL, SW_SHOWNORMAL);
                        }
        }
    }
  return 0;
}
fstream fin("data.txt",ios::in);

int main(){
    cout<<"Load Macros ? ";
    cin>>order;
    if(stricmp(order,"yes")==0){
        cout<<"Loading ";
        fin>>mact;
        for(i=1;i<=mact;i++){
            cout<<"*";
            fin>>macl;fin>>alias[i][0];
            for(i2=1;i2<=macl;i2++){
                     fin>>alias[i][i2];
            }
            fin.get();
            strcpy(alias[i][i2],"end");

        }
        cout<<endl;
        cout<<"Macro's Loaded ! "<<endl;
    }
    while(cin>>cmdtype>>cmd){
        strcpy(ex,"");
        if(stricmp(cmdtype,"url")==0){
           she=1;
           if(!strstr(cmd,"http://")){
                strcpy(ex,"http://");
                strcat(ex,cmd);
           }
        }
        else if(stricmp(cmdtype,"prg")==0){
            she=1;
                strcpy(ex,cmd);
        }
        else if(stricmp(cmdtype,"sys")==0){
            she=0;
           if(stricmp(cmd,"exit")==0) return 0;
           if(stricmp(cmd,"macro")==0) {cin>>cmd;alias_ex(cmd);}
        }
        cout<<"Executing: "<<cmdtype<<" "<<ex<<endl;
        if(she) ShellExecute(NULL, "open", ex ,NULL, NULL, SW_SHOWNORMAL);
    }
    fin.close();
}

P.S Macro Edit DOES NOT WORK !
Macro Ex :

2
3 wow http://www.google.ro http://www.youtube.com http://www.mmochampion.com
2 gog http://www.google.ro http://www.youtube.com

Have Fun Using This ! :)

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.