• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 03:22
CEST 09:22
KST 16:22
  • 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
Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12TL.net Map Contest #22 - Voting & Ladder Map Selection7Code S Season 2 (2026) - RO8 Preview8[ASL21] Finals Preview: Two Legacies21
Community News
ZeroSpace at Steam NextFest - Last free demo20Weekly Cups (June 8-14): Clem and Solar double, PTR tested0RSL: S6 Finals played at BlizzCon 202611Douyu Cup 2026: $20,000 Legends Event (June 26-28)12[BSL22] Non-Korean Championship from 13 to 28 June4
StarCraft 2
General
StarCraft II 5.0.16 PTR Patch Notes may 26th Is the larve respawn broken? Yamato Cup Series What kind of tool would you be interested in? Daily SC2 Player Grid - feedback wanted
Tourneys
Douyu Cup 2026: $20,000 Legends Event (June 26-28) GSL CK #4 20-21th June Sparkling Tuna Cup - Weekly Open Tournament Master Swan Open (Global Bronze-Master 2) Crank Gathers Season 4: BW vs SC2 Team League
Strategy
[G] Having the right mentality to improve
Custom Maps
Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
The PondCast: SC2 News & Results Mutation # 531 Experimental Artillery Mutation # 530 One For All Mutation # 529 Opportunities Unleashed
Brood War
General
BGH Auto Balance -> http://bghmmr.eu/ STARCRAFT MOVIE - Last Night at the Command center BW General Discussion Battle cruiser feet vs Carrier fleet Fact based Zerg Upgrade Tier List
Tourneys
CSLAN 4 is Coming! [Megathread] Daily Proleagues Small VOD Thread 2.0 The Casual Games of the Week Thread
Strategy
Why doesn't anyone use restoration? Simple Questions, Simple Answers Relatively freeroll strategies Creating a full chart of Zerg builds
Other Games
General Games
Stormgate/Frost Giant Megathread Beyond All Reason Path of Exile ZeroSpace at Steam NextFest - Last free demo Nintendo Switch Thread
Dota 2
Looking for a Dota Mentor 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
TL Mafia
Vanilla Mini Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread [H]Internet/Gaming Cafe Tips and Tricks The Games Industry And ATVI UK Politics Mega-thread
Fan Clubs
The HerO Fan Club! The herO Fan Club!
Media & Entertainment
Movie Discussion! [Req][Books] Good Fantasy/SciFi books [TV/BOOK] *SPOILERS* Game of Thrones Discussion
Sports
2024 - 2026 Football Thread McBoner: A hockey love story TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion Cricket [SPORT]
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
How To Predict Tilt in Espor…
TrAiDoS
An Exploration of th…
waywardstrategy
I'm an arrogant trash talke…
FlaShFTW
Gauntlet SC2: A Retrospectiv…
Ctone23
Why RTS gamers make better f…
gosubay
Customize Sidebar...

Website Feedback

Closed Threads



Active: 9390 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 States17291 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 States17291 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 States17291 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 3h 38m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft509
Nina 121
RuFF_SC2 72
StarCraft: Brood War
Leta 166
Hm[arnc] 71
Larva 37
soO 18
Dota 2
NeuroSwarm114
League of Legends
JimRising 666
Counter-Strike
summit1g11376
Other Games
ceh9354
Happy277
KnowMe11
Organizations
Dota 2
PGL Dota 2 - Secondary Stream5534
Other Games
gamesdonequick1057
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 15 non-featured ]
StarCraft 2
• practicex 9
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Rush1731
• Jankos559
• Stunt470
• HappyZerGling105
Upcoming Events
WardiTV Weekly
3h 38m
Monday Night Weeklies
8h 38m
Sparkling Tuna Cup
1d 2h
The PondCast
2 days
Douyu Cup 2020
2 days
Oliveira vs Trap
Jieshi vs XY
soO vs FanTaSy
TY vs Coffee
Douyu Cup 2020
3 days
Neeb vs Impact
MacSed vs Cyan
Scarlett vs Kelazhur
INnoVation vs Dear
Douyu Cup 2020
4 days
Maestros of the Game
5 days
herO vs Classic
Maru vs Serral
BSL22 NKC (BSL vs China)
5 days
Douyu Cup 2020
5 days
[ Show More ]
BSL22 NKC (BSL vs China)
6 days
Online Event
6 days
RSL Revival
6 days
Liquipedia Results

Completed

Acropolis #4
WardiTV Spring 2026
Heroes Pulsing #2

Ongoing

IPSL Spring 2026
CSCL: Masked Kings S4
YSL S3
BSL 22 Non-Korean Championship
CSL Season 21: Qualifier 1
SCTL 2026 Spring
Maestros of the Game 2
Murky Cup 2026
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026

Upcoming

CSL Season 21: Qualifier 2
CSL 2026 Summer (S21)
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
Douyu Cup 2026
BCC 2026
Light HT
Heroes Pulsing #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 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.