Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

++** Borland C++ Problem**++

  • 26-04-2004 10:04PM
    #1
    Registered Users, Registered Users 2 Posts: 155 ✭✭


    Does any one know the code for a buttom in Borland C++ Builder to:

    'Call & open up a certain Web page on the Internet'

    Also a function that will 'open a bland .txt Notepad doucment'

    Thanks


Comments

  • Registered Users, Registered Users 2 Posts: 5,333 ✭✭✭Cake Fiend


    You could probably use the system() function for both of those.


  • Registered Users, Registered Users 2 Posts: 155 ✭✭tranceenigma


    Thanks for the fast Reply Ciso. I am totally new to the aread of programming ....
    Would u be able to elaborate on that "system() function" command if possible please & give a tiny explaniation on how it works aswell.

    Thank you Kindly.....


  • Registered Users, Registered Users 2 Posts: 1,481 ✭✭✭satchmo


    The ShellExecute() function will do that. Try:
    ShellExecute(NULL, "open", "http://www.boards.ie", NULL, NULL, SW_SHOWNORMAL);//open a webpage
    ShellExecute(NULL, "open", "c:\\MyTextFile.txt", NULL, NULL, SW_SHOWNORMAL);//open a text file in default editor
    
    For the blank text file you try using fopen() and then fclose() it again, but there's probably a better way.


  • Registered Users, Registered Users 2 Posts: 5,333 ✭✭✭Cake Fiend


    I had no idea they had made Google so hard to use.

    Last time I used it, all you had to do was type a search query, in this case 'system() function', into a little box and hit the 'Google Search' button.

    The alternative would be to search the Borland manual/readme/help files.

    Yet another way, seeing as you're presumably doing this for homework of some sort, would be to either ask your lecturer, or listen in class/read your texts in the first place.

    I was deliberately vague with my reply in order to get you off your ass to do some searching.


  • Closed Accounts Posts: 256 ✭✭$lash


    
    #include<fstream> //make sure you include this header
    
    
    void main()
    {
          fstream in_out ("file1.txt", ios::in | ios::out); //opens a file for input & output
    }
    
    


  • Advertisement
Advertisement