ok ihave looked through google and cprograming.com and cant find much to do with opning documents like...

i am trying to do...

run the c++ program select a number and open an html document
...
...
yes i know basic html...
thanks...
--wingwarp--

Explain.
How do you get the filename that you want to open?
What is the significance of the input number and the file you want to open?
When you say open, does that mean open using a browser, or just using fstream or fopen?

wingwarp

What WolfPack said, and please post your code so "we" can see what the issue(s) might be - help "us" help you and your problem will likely be resolved a lot quicker.

i havent made any code yet but i was wondering if i could like...
have the user select a number and have the program open the Episode 1.html doucment...

i havent made any code yet but i was wondering if i could like...
have the user select a number and have the program open the Episode 1.html doucment...

Yes you can.

Here is a similar code snippet. Instead of using a loop, you can get the number from the keyboard and pass that to snprintf .

i am trying to make a program for a friend and he loves an anime on utube and hates looking for the episodes so i was trying to make him a program that will opne the episode_1.html document in the folder of the saved exe.

he game me this url and i created this...

<center>
<object width="850" height="700"><param name="movie" value="<A href="http://www.youtube.com/v/Iy-SkscoPZ0"></param><embed">http://www.youtube.com/v/Iy-SkscoPZ0"></param><embed src="[URL]http://www.youtube.com/v/Iy-SkscoPZ0[/URL]" type="application/x-shockwave-flash" width="850" height="700"></embed></object>
<body bgcolor="black">
</center>

and it works great... its a music video...

and i curently have this as my c++

#include <iostream>
using namespace std;
int main(){
    int epi;
    int ever;
    
    ever=1;
    while (ever == 1){
          cout<<"type 1-197 to open that episode";
          cin>>epi;
          if (epi == 1){
                      char filename[ 20 ] = "";
                      snprintf( filename, 19, "epi1.html");
                      printf("%s\n", filename );
                      // pass filename to your xml file opening function
                      }
          }
}

any help would be great...

Please give FINE detail thanks... sometimes i can be very dumb...

This code should work.

#include <iostream>
using namespace std;
int main()
{
    int epi;
    char quit;
    
    quit='N';
    while (quit !='Y' && quit!='y')
    {
         cout<<"type 1-197 to open that episode";
         cin>>epi;
         if (epi >= 1 && epi <= 197)
         {
              char filename[ 20 ] = "";
              snprintf( filename, 19, "epi%d.html", epi );
              printf("%s\n", filename );
              // pass filename to your xml file opening function
         }
         cout<<"Quit(Y/N)?";
         cin>>quit;
    }
}

...

thanks but i got that little part as a code snippet and i dont have a xml file opener function or id dont know i had one....


can u help again...

sorry for all the hastle...

Wouldn't shellexecute work?

ShellExecute(NULL, NULL, "epi1.htm", NULL, "C:/folderwithmovies", SW_SHOWDEFAULT);

This code can be used to open epi1.html which is located in C:/folderwithmovies.

If you're not sure about that code pay a visit to MSDN and search for shellexecute.


Greetz, Eddy

Sorry I didn't get you. I made a few changes to the code you posted, and now it is working correctly. If this comment

// pass filename to your xml file opening function

confused you, it was a leftover from the code snippet. You should open the html file after that.
Run the program and see what happens.
If you need further help be a little more descriptive.

You should start a new thread. This one's a year and a half old. Also, remember the "Keep it on the site" rule. Post your question and have people comment on it in a public thread rather than e-mail your private e-mail address.

If you don't want your e-mail address up there anymore, you can possibly click "Edit this post" and remove it (might be too late now). If it's too late and you can no longer edit and you want it taken down, you can hit the "Flag Bad Post" button with a explanation/request to a moderator to snip the e-mail address.

This article has been dead for over six months. Start a new discussion instead.