• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 11:47
CET 17:47
KST 01:47
  • 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
ByuL: The Forgotten Master of ZvT25Behind the Blue - Team Liquid History Book17Clem wins HomeStory Cup 289HomeStory Cup 28 - Info & Preview13Rongyi Cup S3 - Preview & Info8
Community News
Weekly Cups (Feb 9-15): herO doubles up2ACS replaced by "ASL Season Open" - Starts 21/0241LiuLi Cup: 2025 Grand Finals (Feb 10-16)46Weekly Cups (Feb 2-8): Classic, Solar, MaxPax win2Nexon's StarCraft game could be FPS, led by UMS maker16
StarCraft 2
General
Behind the Blue - Team Liquid History Book ByuL: The Forgotten Master of ZvT Liquipedia WCS Portal Launched Kaelaris on the futue of SC2 and much more... How do you think the 5.0.15 balance patch (Oct 2025) for StarCraft II has affected the game?
Tourneys
PIG STY FESTIVAL 7.0! (19 Feb - 1 Mar) Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) How do the "codes" work in GSL? LiuLi Cup: 2025 Grand Finals (Feb 10-16)
Strategy
Custom Maps
Map Editor closed ? [A] Starcraft Sound Mod
External Content
The PondCast: SC2 News & Results Mutation # 513 Attrition Warfare Mutation # 512 Overclocked Mutation # 511 Temple of Rebirth
Brood War
General
Do you consider PvZ imbalanced? Recent recommended BW games BGH Auto Balance -> http://bghmmr.eu/ BW General Discussion CasterMuse Youtube
Tourneys
Escore Tournament StarCraft Season 1 [Megathread] Daily Proleagues Small VOD Thread 2.0 KCM Race Survival 2026 Season 1
Strategy
Simple Questions, Simple Answers Zealot bombing is no longer popular? Fighting Spirit mining rates Current Meta
Other Games
General Games
Battle Aces/David Kim RTS Megathread Diablo 2 thread Nintendo Switch Thread ZeroSpace Megathread Path of Exile
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
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 TL Mafia Community Thread Mafia Game Mode Feedback/Ideas
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Canadian Politics Mega-thread Ask and answer stupid questions here! Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club The herO Fan Club!
Media & Entertainment
[Req][Books] Good Fantasy/SciFi books [Manga] One Piece Anime Discussion Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TL MMA Pick'em Pool 2013
World Cup 2022
Tech Support
TL Community
The Automated Ban List
Blogs
ASL S21 English Commentary…
namkraft
Inside the Communication of …
TrAiDoS
My 2025 Magic: The Gathering…
DARKING
Life Update and thoughts.
FuDDx
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1879 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 States17278 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 States17278 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 States17278 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 7h 14m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ProTech132
BRAT_OK 83
trigger 47
gerald23 38
EmSc Tv 24
MindelVK 16
StarCraft: Brood War
Britney 36922
Calm 4640
Jaedong 994
Horang2 917
Larva 659
Stork 607
Mini 553
actioN 343
Soma 285
Zeus 177
[ Show more ]
hero 149
Movie 137
PianO 116
Rush 115
Sharp 107
Shine 66
soO 36
yabsab 31
HiyA 31
Hm[arnc] 26
scan(afreeca) 22
Rock 21
sorry 18
Sacsri 17
NaDa 15
Dota 2
Gorgc4674
qojqva1894
XcaliburYe125
canceldota36
Counter-Strike
fl0m6084
shoxiejesuss2487
byalli1197
Super Smash Bros
Mew2King100
Heroes of the Storm
Khaldor646
Liquid`Hasu374
Other Games
Grubby5148
singsing2282
Liquid`RaSZi1642
FrodaN687
Sick202
B2W.Neo199
QueenE91
Organizations
Counter-Strike
PGL88210
StarCraft 2
WardiTV1036
EmSc Tv 24
EmSc2Tv 24
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 16 non-featured ]
StarCraft 2
• HeavenSC 25
• poizon28 6
• OhrlRock 1
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• Michael_bg 1
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2239
Counter-Strike
• C_a_k_e 1549
Upcoming Events
Replay Cast
7h 14m
Replay Cast
16h 14m
Wardi Open
19h 14m
Monday Night Weeklies
1d
OSC
1d 7h
WardiTV Winter Champion…
1d 19h
Replay Cast
2 days
WardiTV Winter Champion…
2 days
The PondCast
3 days
Replay Cast
4 days
[ Show More ]
Korean StarCraft League
5 days
CranKy Ducklings
5 days
SC Evo Complete
5 days
Replay Cast
6 days
Sparkling Tuna Cup
6 days
uThermal 2v2 Circuit
6 days
Liquipedia Results

Completed

[S:21] ASL SEASON OPEN 1st Round
LiuLi Cup: 2025 Grand Finals
Underdog Cup #3

Ongoing

KCM Race Survival 2026 Season 1
WardiTV Winter 2026
PiG Sty Festival 7.0
Nations Cup 2026
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 2025
SL Budapest Major 2025

Upcoming

Acropolis #4 - TS5
Jeongseon Sooper Cup
Spring Cup 2026
[S:21] ASL SEASON OPEN 2nd Round
[S:21] ASL SEASON OPEN 2nd Round Qualifier
Acropolis #4 - TS6
Acropolis #4
HSC XXIX
uThermal 2v2 2026 Main Event
Bellum Gens Elite Stara Zagora 2026
RSL Revival: Season 4
PGL Astana 2026
BLAST Rivals Spring 2026
CCT Season 3 Global Finals
FISSURE Playground #3
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League Season 23
ESL Pro League Season 23
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.