0
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", "",NULL, NULL, SW_SHOWNORMAL);
Data :
2
string
google
Hope someone can figure out what i did wrong , thanks for trying to help :)