Just wondering if this is possible, basically I have some stored values that I want inserted into the middle of a URL in my C++ program. I then want the program to open up the URL with inserted data into the default browser. If anyone could give me any info it would be much appreciated.

It is possible, but there is not enough info here. How are you generating the URL? What are these values for? Where in the URL did you want to put them?

Most importantly, what have you tried so far?

I'm rather new to c++ so have had no idea how to accomplish this after much googling. The url would need 2 numbers place in specific parts. e.g.

xyz.com/num1insertedxyzxyzxyznum2inserted.html

Thankyou for your response.

You didn't answer all my questions. Where is the URL coming from? Are you building it from scratch or are you getting it from somewhere and modifying it?

Did you follow the link I gave you in my previous post?

You can do it with simple concatenation, but there may be more to it depending on the information already in existence.

I did look at the link but I'm unsure how I can show effort when google searching came up with nothing and looking through my C++ books I can't even think of how to start such a thing. The URL is a google maps URL, where longitude and latitude values are inserted.

Concatenation is what you need, look it up and see what you can figure out.

Unfortunately, the functions/operators you use will depend on if you are using C-style strings (null-terminated char arrays) or if you are using the actual C++ "string" data type. They will also depend on if you are building the address dynamically or modifying the values contained in an existing address.

This is a very simple example using the "string" data type:

#include <iostream>
#include <string>

using namespace std;

int main() {
  //declare some strings
  string seg1, seg2, seg3;

  //assign values to seg1 and seg2
  seg1 = "www.dani";
  seg2 = "web.com";

  //concatenate seg1 and seg2, store in seg3
  seg3 = seg1 + seg2;

  cout << seg3 << endl;
  // should output "www.daniweb.com"

  cin.get();
  return 0;
}
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.