• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:26
CEST 23:26
KST 06:26
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL21] Ro16 Preview Pt2: All Star10Team Liquid Map Contest #22 - The Finalists16[ASL21] Ro16 Preview Pt1: Fresh Flow9[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0
Community News
2026 GSL Season 1 Qualifiers13Maestros of the Game 2 announced82026 GSL Tour plans announced14Weekly Cups (April 6-12): herO doubles, "Villains" prevail1MaNa leaves Team Liquid24
StarCraft 2
General
Maestros of the Game 2 announced Team Liquid Map Contest #22 - The Finalists MaNa leaves Team Liquid 2026 GSL Tour plans announced Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool
Tourneys
Sparkling Tuna Cup - Weekly Open Tournament 2026 GSL Season 1 Qualifiers GSL CK: More events planned pending crowdfunding RSL Revival: Season 5 - Qualifiers and Main Event Master Swan Open (Global Bronze-Master 2)
Strategy
Custom Maps
[D]RTS in all its shapes and glory <3 [A] Nemrods 1/4 players [M] (2) Frigid Storage
External Content
Mutation # 522 Flip My Base The PondCast: SC2 News & Results Mutation # 521 Memorable Boss Mutation # 520 Moving Fees
Brood War
General
Pros React To: ASL S21, Ro.16 Group C ASL21 General Discussion BGH Auto Balance -> http://bghmmr.eu/ [TOOL] Starcraft Chat Translator Data needed
Tourneys
[ASL21] Ro16 Group C [Megathread] Daily Proleagues [ASL21] Ro16 Group D [ASL21] Ro16 Group B
Strategy
Simple Questions, Simple Answers What's the deal with APM & what's its true value Any training maps people recommend? Fighting Spirit mining rates
Other Games
General Games
Diablo IV Nintendo Switch Thread Dawn of War IV Starcraft Tabletop Miniature Game General RTS Discussion Thread
Dota 2
The Story of Wings Gaming
League of Legends
G2 just beat GenG in First stand
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
Vanilla Mini Mafia Mafia Game Mode Feedback/Ideas TL Mafia Community Thread Five o'clock TL Mafia
Community
General
Things Aren’t Peaceful in Palestine US Politics Mega-thread Canadian Politics Mega-thread Russo-Ukrainian War Thread YouTube Thread
Fan Clubs
The IdrA Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
McBoner: A hockey love story 2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Sexual Health Of Gamers
TrAiDoS
lurker extra damage testi…
StaticNine
Broowar part 2
qwaykee
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2916 users

The Big Programming Thread - Page 92

Forum Index > General Forum
Post a Reply
Prev 1 90 91 92 93 94 1032 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
October 29 2011 19:33 GMT
#1821
On October 30 2011 04:28 delHospital wrote:
Show nested quote +
On October 30 2011 04:16 Isualin wrote:
hello im new in c++. i was using Convert.ToDouble(blabla) in c# but i dont know how to do this in c++. so how can i convert char '3' to double 3. i need to get values from a char array like "6-8*2+45".

use sscanf from stdio.h
Show nested quote +
On October 30 2011 04:22 LionKiNG wrote:
EDIT: Sorry, this should work better:
char ch = "A";
int i = ch;
double = (double)i;

this won't even compile


I fixed quotations, it was typo and yes it compiles.
Isualin
Profile Joined March 2011
Germany1903 Posts
October 29 2011 19:38 GMT
#1822
yes and i have to use two stacks to hold the values, . one will keep 6,8,2 and 45 other one will keep '-' '*' and '+', but i dont have problems with that. thanks for help i will try these
| INnoVation | The literal god TY | ByuNjwa | LRSL when? |
Craton
Profile Blog Joined December 2009
United States17281 Posts
October 30 2011 12:50 GMT
#1823
I'm working on a way to programmatically open a user's default browser, maximize it, and press play on an embedded flash stream, specifically for Own3D. I'm using C# / Windows Forms.

This URL will autoplay, but the player size is fixed (and small) and I don't know how (or if you can) full screen the flash player from the program.
System.Diagnostics.Process.Start("http://www.own3d.tv/liveembed/81266?autoPlay=true");


This URL will fit the screen (so it's as big as the browser), but won't autoplay.
System.Diagnostics.Process.Start("http://www.own3d.tv/livepopout/clgame_38728");


I'm also unsure how to maximize the browser after opening it, while still making sure it's at the front of whatever else is open.
twitch.tv/cratonz
Necosarius
Profile Blog Joined September 2009
Sweden4042 Posts
October 30 2011 12:59 GMT
#1824
On October 26 2011 01:01 LunaSaint wrote:
Necosarius:

Tuples can't be changed when they're made, so the method you currently use would not work with them.
Also, you said that you were meant to make a list of tuples. A list of tuples would look like this:

[(0,0), (0,1), (0,2)]

This basically makes a table that has as many columns as there are tuples, and as many rows as there are values within the tuples. In other words, you're making a structure like this:

0|0|0
0|1|2


If that doesn't help, the spoiler details how it would look for a dictionary.

+ Show Spoiler [What a dictionary would look like as a…] +
[("Apple", "A red or green fruit found on trees."), ("Banana", "A yellow, curved fruit found on trees in warmer climates."), ('Name', 'Description')]


This way, you have a list of tuples containing a word and its definition.


Apple |Banana
A red or green fruit found on trees.|A yellow, curved fruit found on trees in...


You said you just wanted a hint, so I won't explain how you'd integrate it into a dictionary, but I hope that makes sense.

--

Halp!:

I'm going to be using Python with Pygame to make a basic Turn Based Strategy using a square grid system, but there's still a lot of image based functions of Pygame I don't grasp.
I'm trying to work out how to import a segment of an image only - in this case, a tile from a tileset.

Thank you, I was able to figure it out ^^
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2011-10-30 13:10:52
October 30 2011 13:09 GMT
#1825
On October 30 2011 21:50 Craton wrote:
I'm working on a way to programmatically open a user's default browser, maximize it, and press play on an embedded flash stream, specifically for Own3D. I'm using C# / Windows Forms.

This URL will autoplay, but the player size is fixed (and small) and I don't know how (or if you can) full screen the flash player from the program.
System.Diagnostics.Process.Start("http://www.own3d.tv/liveembed/81266?autoPlay=true");


This URL will fit the screen (so it's as big as the browser), but won't autoplay.
System.Diagnostics.Process.Start("http://www.own3d.tv/livepopout/clgame_38728");


I'm also unsure how to maximize the browser after opening it, while still making sure it's at the front of whatever else is open.


While this isn't impossible, it's very close to that since you can't control a Firefox, Chrome or Opera browser directly.

However, you can use a WebBrowser Control in your application to embed the Internet Explorer and open the page with it. AFAIK it is also possible to execute your own Javascript to "press play" on the stream.

Then just have the WebBrowser instance open in a new, maximized frame with "Always on Top" enabled and it should work as you want it to.

Haven't used the WebBrowser Control myself, so can't give you any specifics, but i have seen similar things done with it.
Craton
Profile Blog Joined December 2009
United States17281 Posts
Last Edited: 2011-10-30 20:16:38
October 30 2011 13:43 GMT
#1826
You'd have to give me an example on how to javascript rig it to start / full screen.

My googling seems to imply that such a thing is impossible.

The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception.

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html

How can I open a web browser through C# that has the bars at the top hidden and scroll bars disabled? I know you can normally do it through an html button with javascript tied to it, but I can't figure out how to do that in C#.

---

Running the code below throws an error:
ex = {"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."}

frmBrowser is a form containing a WebBrowser control and nothing else. The earlier part of the code basically sets an alarm and when it goes off calls the second function. I set it to just wait 2 seconds for development purposes.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.IO;

namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
CultureInfo provider = CultureInfo.CurrentCulture;

DateTime alarmDateTime = DateTime.Now.AddSeconds(2);
OpenBrowser openBrowser = new OpenBrowser();
TimerCallback callback = openBrowser.CheckOnline;

System.Threading.Timer timer = new System.Threading.Timer(callback, null, alarmDateTime - DateTime.Now, TimeSpan.FromHours(24));
}
}

class OpenBrowser
{
public void CheckOnline(Object stateInfo)
{
try
{
String id = "13574";

OpenStream(id);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

private void OpenStream(string id)
{
frmBrowser frm = new frmBrowser();
}
}
}


Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}


File: http://www.mediafire.com/?ef958apbjgn369b

I condensed everything from the original project to this secondary project to try and weed out the problem, but I can't figure out how to solve it.
twitch.tv/cratonz
Orome
Profile Blog Joined June 2004
Switzerland11984 Posts
Last Edited: 2011-10-31 05:54:36
October 31 2011 03:02 GMT
#1827
edit: nvm
On a purely personal note, I'd like to show Yellow the beauty of infinitely repeating Starcraft 2 bunkers. -Boxer
Deleted User 101379
Profile Blog Joined August 2010
4849 Posts
Last Edited: 2011-10-31 08:21:55
October 31 2011 08:21 GMT
#1828
On October 30 2011 22:43 Craton wrote:
You'd have to give me an example on how to javascript rig it to start / full screen.

My googling seems to imply that such a thing is impossible.

Show nested quote +
The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception.

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html

How can I open a web browser through C# that has the bars at the top hidden and scroll bars disabled? I know you can normally do it through an html button with javascript tied to it, but I can't figure out how to do that in C#.

---

Running the code below throws an error:
ex = {"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."}

frmBrowser is a form containing a WebBrowser control and nothing else. The earlier part of the code basically sets an alarm and when it goes off calls the second function. I set it to just wait 2 seconds for development purposes.

+ Show Spoiler +


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.IO;

namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
CultureInfo provider = CultureInfo.CurrentCulture;

DateTime alarmDateTime = DateTime.Now.AddSeconds(2);
OpenBrowser openBrowser = new OpenBrowser();
TimerCallback callback = openBrowser.CheckOnline;

System.Threading.Timer timer = new System.Threading.Timer(callback, null, alarmDateTime - DateTime.Now, TimeSpan.FromHours(24));
}
}

class OpenBrowser
{
public void CheckOnline(Object stateInfo)
{
try
{
String id = "13574";

OpenStream(id);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

private void OpenStream(string id)
{
frmBrowser frm = new frmBrowser();
}
}
}


Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}



File: http://www.mediafire.com/?ef958apbjgn369b

I condensed everything from the original project to this secondary project to try and weed out the problem, but I can't figure out how to solve it.


You are creating the frmBrowser from a different Thread. This is not allowed by .NET. You have to use Invoke to change the thread context to the GUI thread.

Pass a reference to the Form1 to OpenBrowser and then call yourForm1Variable.Invoke(OpenStream, new object[]{id}).

See: http://msdn.microsoft.com/en-US/library/a1hetckb.aspx

As for executing Javascript in the WebBrowser Control a quick google showed this two links. For more details, you might have to google yourself:

http://notions.okuda.ca/2009/06/11/calling-javascript-in-a-webbrowser-control-from-c/
http://stackoverflow.com/questions/1437251/calling-a-javascript-function-in-the-c-sharp-webbrowser-control

The scrollbars can be removed by injecting a CSS style (for example via Javascript), i think it's "body.scroll" that has to be set to "no". From what i found from google, it's not possible to do that via C#.


SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
Last Edited: 2011-10-31 18:23:18
October 31 2011 18:19 GMT
#1829
On October 30 2011 22:43 Craton wrote:
You'd have to give me an example on how to javascript rig it to start / full screen.

My googling seems to imply that such a thing is impossible.

Show nested quote +
The ActionScript that initiates full-screen mode can be called only in response to a mouse event or keyboard event. If it is called in other situations, Flash Player throws an exception.

http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7c5d.html

How can I open a web browser through C# that has the bars at the top hidden and scroll bars disabled? I know you can normally do it through an html button with javascript tied to it, but I can't figure out how to do that in C#.

---

Running the code below throws an error:
ex = {"ActiveX control '8856f961-340a-11d0-a96b-00c04fd705a2' cannot be instantiated because the current thread is not in a single-threaded apartment."}

frmBrowser is a form containing a WebBrowser control and nothing else. The earlier part of the code basically sets an alarm and when it goes off calls the second function. I set it to just wait 2 seconds for development purposes.


using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Windows.Forms;
using System.Globalization;
using System.Threading;
using System.IO;

namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
CultureInfo provider = CultureInfo.CurrentCulture;

DateTime alarmDateTime = DateTime.Now.AddSeconds(2);
OpenBrowser openBrowser = new OpenBrowser();
TimerCallback callback = openBrowser.CheckOnline;

System.Threading.Timer timer = new System.Threading.Timer(callback, null, alarmDateTime - DateTime.Now, TimeSpan.FromHours(24));
}
}

class OpenBrowser
{
public void CheckOnline(Object stateInfo)
{
try
{
String id = "13574";

OpenStream(id);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

private void OpenStream(string id)
{
frmBrowser frm = new frmBrowser();
}
}
}


Program.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace WindowsFormsApplication3
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}


File: http://www.mediafire.com/?ef958apbjgn369b

I condensed everything from the original project to this secondary project to try and weed out the problem, but I can't figure out how to solve it.



There is C# function that lets u send mouse/keyboard inputs to other programs, as for your problem, there are few methods to detect default browser, and after u do that u can pass website with javascript edit:

using System;
using System.Diagnostics;

......
Process _browser = new Process();
switch(...)
{
......
// Lets say u implant each browser support and somehow u identify browser as Mozila:
case Mozila:
{
_browser.StartInfo.FileName = "mozila.exe"; // lets assume, but through methods that read default browser's location u can just pass that(This is file path i believe)
_browser.StartInfo.Arguments = "\"www.own3d.tv............/20498120841048&<Java script for playnow>"\";
}
}
_browser.Start();
...........
now u can send keys to process and therefore make it full screen, i think keys are passed as keyboard inputs and therefore ActionScript should not throw anything.

defnotGeorge
Profile Joined October 2010
United States80 Posts
November 01 2011 01:10 GMT
#1830
"The best way to celebrate Halloween is by writing scary code."
DanceSC
Profile Blog Joined March 2008
United States751 Posts
November 01 2011 01:19 GMT
#1831
you.dead = true;
you.rot();
for(int i=0; i < allYourFriends.length; i++){
allYourFriends[i].danceOnYourGrave();
}
from a game lol
Dance.943 || "I think he's just going to lose. There's only so many ways you can lose. And he's going to make some kind of units. And I'm going to attack him, and then all his stuff is going to die. That's about the best prediction that I can make" - NonY
Craton
Profile Blog Joined December 2009
United States17281 Posts
November 01 2011 01:22 GMT
#1832
The current implementation I'm using is to just use a WebBrowser control, rather than dealing with determining the browser, trying to strip it to a minimal view, and making sure its maximized. Much easier to just deal with the form.

I came across the Invoke requirement in some of my googling, but didn't know how to apply it. I'll give it a try in a bit.
twitch.tv/cratonz
frogmelter
Profile Blog Joined April 2009
United States971 Posts
Last Edited: 2011-11-02 23:40:16
November 02 2011 23:04 GMT
#1833
Does anyone know how to pass a vector as an argument to a pthread in C++?

Thanks in advance!

This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type" on line "vector<string> wtf = *url;"

static void *thread_func(void *url)
{
vector<string> wtf = *url;
//Print out the vector
for (vector<string>::iterator i = wtf.begin(); i != wtf.end(); ++i)
{
cout << *i << endl;
}
}

int main()
{
....
vector<string> wtf;
for(int i=0; i< NUMT; i++)
{
error = pthread_create(&tid[i], NULL, thread_func, (void *)&wtf);
}
}
TL+ Member
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
November 02 2011 23:26 GMT
#1834
On November 03 2011 08:04 frogmelter wrote:
Does anyone know how to pass a vector as an argument to a pthread in C++?

Thanks in advance!

This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type"

static void *thread_func(void *url)
{
vector<string> wtf = *url;
//Print out the vector
for (vector<string>::iterator i = wtf.begin(); i != wtf.end(); ++i)
{
cout << *i << endl;
}
}

int main()
{
....
vector<string> wtf;
for(int i=0; i< NUMT; i++)
{
error = pthread_create(&tid[i], NULL, thread_func, (void *)&wtf);
}
}


Try accessing vector as an array? Maybe some foreach wrapper could help(or for -> with itr?)?
frogmelter
Profile Blog Joined April 2009
United States971 Posts
November 02 2011 23:38 GMT
#1835
On November 03 2011 08:26 SRBNikola wrote:
Show nested quote +
On November 03 2011 08:04 frogmelter wrote:
Does anyone know how to pass a vector as an argument to a pthread in C++?

Thanks in advance!

This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type"

static void *thread_func(void *url)
{
vector<string> wtf = *url;
//Print out the vector
for (vector<string>::iterator i = wtf.begin(); i != wtf.end(); ++i)
{
cout << *i << endl;
}
}

int main()
{
....
vector<string> wtf;
for(int i=0; i< NUMT; i++)
{
error = pthread_create(&tid[i], NULL, thread_func, (void *)&wtf);
}
}


Try accessing vector as an array? Maybe some foreach wrapper could help(or for -> with itr?)?


Sorry I forgot to mention - It errors out at the line "vector<string> wtf = *url;"

I tested the print out in the main thread and it works, so I don't think that is the problem
TL+ Member
razzloss
Profile Joined October 2010
Finland4 Posts
November 02 2011 23:58 GMT
#1836
Casting wtf to void* in pthread_create is unnecessary. However you do need to cast the void* back to vector<string>* in thread_func.

Then you'll just have to hope that the wtf in main stays alive long enough for the thread_func to make a copy of it, or use something like semaphores to signal between the threads that the wtf has been safely copied.
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
November 03 2011 00:45 GMT
#1837
On November 03 2011 08:38 frogmelter wrote:
Show nested quote +
On November 03 2011 08:26 SRBNikola wrote:
On November 03 2011 08:04 frogmelter wrote:
Does anyone know how to pass a vector as an argument to a pthread in C++?

Thanks in advance!

This is what a have so far [well, parts of what I have. I think this is all the relevant information], error message is "‘void*’ is not a pointer-to-object type"

static void *thread_func(void *url)
{
vector<string> wtf = *url;
//Print out the vector
for (vector<string>::iterator i = wtf.begin(); i != wtf.end(); ++i)
{
cout << *i << endl;
}
}

int main()
{
....
vector<string> wtf;
for(int i=0; i< NUMT; i++)
{
error = pthread_create(&tid[i], NULL, thread_func, (void *)&wtf);
}
}


Try accessing vector as an array? Maybe some foreach wrapper could help(or for -> with itr?)?


Sorry I forgot to mention - It errors out at the line "vector<string> wtf = *url;"

I tested the print out in the main thread and it works, so I don't think that is the problem


I think thats illegal in C++, what are u trying to do?
frogmelter
Profile Blog Joined April 2009
United States971 Posts
November 03 2011 03:31 GMT
#1838
Ahhh I got it

vector<string> *vecPtr = (vector<string>*)url;
for (vector<string>::iterator i = vecPtr->begin(); i != vecPtr->end();++i)
{
cout << *i << endl;
}

It was throwing an error before because it said that vecPtr had no class member called begin. But then I realized that it was a pointer to a vector, rather than the vector itself
TL+ Member
SRBNikola
Profile Blog Joined July 2011
Serbia191 Posts
November 03 2011 09:42 GMT
#1839
On November 03 2011 12:31 frogmelter wrote:
Ahhh I got it

vector<string> *vecPtr = (vector<string>*)url;
for (vector<string>::iterator i = vecPtr->begin(); i != vecPtr->end();++i)
{
cout << *i << endl;
}

It was throwing an error before because it said that vecPtr had no class member called begin. But then I realized that it was a pointer to a vector, rather than the vector itself


Why don't you pass vector<string>* as argument of function instead of void* ?
frogmelter
Profile Blog Joined April 2009
United States971 Posts
November 03 2011 18:47 GMT
#1840
On November 03 2011 18:42 SRBNikola wrote:
Show nested quote +
On November 03 2011 12:31 frogmelter wrote:
Ahhh I got it

vector<string> *vecPtr = (vector<string>*)url;
for (vector<string>::iterator i = vecPtr->begin(); i != vecPtr->end();++i)
{
cout << *i << endl;
}

It was throwing an error before because it said that vecPtr had no class member called begin. But then I realized that it was a pointer to a vector, rather than the vector itself


Why don't you pass vector<string>* as argument of function instead of void* ?


Arguments passed to pthreads must be typecasted to a void pointer. That argument can't pass more than 4 bytes, so the only way it works is to typecast it into a void pointer. I just had trouble getting it back into a format that I could read.
TL+ Member
Prev 1 90 91 92 93 94 1032 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 34m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
mouzHeroMarine 437
elazer 239
ProTech145
StarCraft: Brood War
Britney 15487
Calm 2536
BeSt 306
Rush 160
firebathero 80
Terrorterran 17
ajuk12(nOOB) 16
Dota 2
monkeys_forever291
Pyrionflax176
Counter-Strike
pashabiceps2466
tarik_tv2170
fl0m1844
Heroes of the Storm
Liquid`Hasu416
Other Games
summit1g6767
Grubby3894
FrodaN829
shahzam471
mouzStarbuck244
C9.Mang0243
Trikslyr147
ArmadaUGS64
Mew2King54
Organizations
Other Games
BasetradeTV301
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• davetesta3
• Reevou 2
• intothetv
• AfreecaTV YouTube
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• masondota21165
League of Legends
• Doublelift1935
Other Games
• imaqtpie1238
• Shiphtur251
Upcoming Events
Replay Cast
2h 34m
The PondCast
12h 34m
KCM Race Survival
12h 34m
WardiTV Map Contest Tou…
13h 34m
Gerald vs herO
Clem vs Cure
ByuN vs Solar
Rogue vs MaxPax
ShoWTimE vs TBD
OSC
17h 34m
CranKy Ducklings
1d 2h
Escore
1d 12h
RSL Revival
1d 19h
Replay Cast
2 days
WardiTV Map Contest Tou…
2 days
[ Show More ]
Universe Titan Cup
2 days
Rogue vs Percival
Ladder Legends
2 days
uThermal 2v2 Circuit
2 days
BSL
2 days
Sparkling Tuna Cup
3 days
WardiTV Map Contest Tou…
3 days
Ladder Legends
3 days
BSL
3 days
Replay Cast
4 days
Replay Cast
4 days
Wardi Open
4 days
Afreeca Starleague
4 days
Soma vs hero
Monday Night Weeklies
4 days
Replay Cast
5 days
Afreeca Starleague
5 days
Leta vs YSC
Replay Cast
6 days
Liquipedia Results

Completed

Proleague 2026-04-20
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL 2026 SPRING (S20)
IPSL Spring 2026
KCM Race Survival 2026 Season 2
Proleague 2026-04-22
StarCraft2 Community Team League 2026 Spring
WardiTV TLMC #16
Nations Cup 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026

Upcoming

Escore Tournament S2: W4
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
Maestros of the Game 2
2026 GSL S2
RSL Revival: Season 5
2026 GSL S1
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
IEM Atlanta 2026
Asian Champions League 2026
PGL Astana 2026
BLAST Rivals Spring 2026
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2026 TLnet. All Rights Reserved.