• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 13:16
CET 19:16
KST 03:16
  • 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
TL.net Map Contest #21: Winners11Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10[ASL20] Finals Preview: Arrival13TL.net Map Contest #21: Voting12[ASL20] Ro4 Preview: Descent11
Community News
StarCraft, SC2, HotS, WC3, Returning to Blizzcon!45$5,000+ WardiTV 2025 Championship7[BSL21] RO32 Group Stage4Weekly Cups (Oct 26-Nov 2): Liquid, Clem, Solar win; LAN in Philly2Weekly Cups (Oct 20-26): MaxPax, Clem, Creator win10
StarCraft 2
General
SC: Evo Complete - Ranked Ladder OPEN ALPHA Mech is the composition that needs teleportation t TL.net Map Contest #21: Winners StarCraft, SC2, HotS, WC3, Returning to Blizzcon! RotterdaM "Serral is the GOAT, and it's not close"
Tourneys
Constellation Cup - Main Event - Stellar Fest Sparkling Tuna Cup - Weekly Open Tournament $5,000+ WardiTV 2025 Championship Merivale 8 Open - LAN - Stellar Fest Sea Duckling Open (Global, Bronze-Diamond)
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 499 Chilling Adaptation Mutation # 498 Wheel of Misfortune|Cradle of Death Mutation # 497 Battle Haredened Mutation # 496 Endless Infection
Brood War
General
FlaSh on: Biggest Problem With SnOw's Playstyle BGH Auto Balance -> http://bghmmr.eu/ [ASL20] Ask the mapmakers — Drop your questions BW General Discussion Where's CardinalAllin/Jukado the mapmaker?
Tourneys
[Megathread] Daily Proleagues [ASL20] Grand Finals [BSL21] RO32 Group A - Saturday 21:00 CET [BSL21] RO32 Group B - Sunday 21:00 CET
Strategy
PvZ map balance Current Meta How to stay on top of macro? Soma's 9 hatch build from ASL Game 2
Other Games
General Games
Stormgate/Frost Giant Megathread Should offensive tower rushing be viable in RTS games? Nintendo Switch Thread Path of Exile Dawn of War IV
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
TL Mafia Community Thread SPIRED by.ASL Mafia {211640}
Community
General
Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread US Politics Mega-thread The Games Industry And ATVI
Fan Clubs
White-Ra Fan Club The herO Fan Club!
Media & Entertainment
[Manga] One Piece Anime Discussion Thread Movie Discussion! Korean Music Discussion Series you have seen recently...
Sports
2024 - 2026 Football Thread Formula 1 Discussion NBA General Discussion MLB/Baseball 2023 TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List
Blogs
Learning my new SC2 hotkey…
Hildegard
Coffee x Performance in Espo…
TrAiDoS
Saturation point
Uldridge
DnB/metal remix FFO Mick Go…
ImbaTosS
Reality "theory" prov…
perfectspheres
Our Last Hope in th…
KrillinFromwales
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1398 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 States17264 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 States17264 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 States17264 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
Wardi Open
12:00
#60
WardiTV2250
IndyStarCraft 235
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 235
UpATreeSC 87
StarCraft: Brood War
Rain 3549
Horang2 1587
Shuttle 779
firebathero 160
scan(afreeca) 52
sSak 37
Mong 30
Aegong 22
JulyZerg 17
ivOry 6
[ Show more ]
SilentControl 5
Dota 2
Gorgc5362
qojqva3580
420jenkins277
BananaSlamJamma178
XcaliburYe153
League of Legends
rGuardiaN20
Counter-Strike
fl0m572
byalli525
Other Games
FrodaN1033
Beastyqt715
ceh9567
KnowMe280
Lowko263
Sick257
Hui .188
Mew2King150
Liquid`VortiX147
ArmadaUGS79
QueenE48
Trikslyr46
Organizations
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• kabyraGe 105
• Reevou 1
• IndyKCrew
• LaughNgamezSOOP
• sooper7s
• AfreecaTV YouTube
• Migwel
• intothetv
• Kozan
StarCraft: Brood War
• Michael_bg 9
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV218
League of Legends
• Nemesis3571
• TFBlade957
• imaqtpie471
Other Games
• Shiphtur284
Upcoming Events
Replay Cast
4h 44m
WardiTV Korean Royale
17h 44m
OSC
22h 44m
Replay Cast
1d 4h
Replay Cast
1d 14h
Kung Fu Cup
1d 17h
Classic vs Solar
herO vs Cure
Reynor vs GuMiho
ByuN vs ShoWTimE
Tenacious Turtle Tussle
2 days
The PondCast
2 days
RSL Revival
2 days
Solar vs Zoun
MaxPax vs Bunny
Kung Fu Cup
2 days
[ Show More ]
WardiTV Korean Royale
2 days
PiGosaur Monday
3 days
RSL Revival
3 days
Classic vs Creator
Cure vs TriGGeR
Kung Fu Cup
3 days
CranKy Ducklings
4 days
RSL Revival
4 days
herO vs Gerald
ByuN vs SHIN
Kung Fu Cup
4 days
BSL 21
5 days
Tarson vs Julia
Doodle vs OldBoy
eOnzErG vs WolFix
StRyKeR vs Aeternum
Sparkling Tuna Cup
5 days
RSL Revival
5 days
Reynor vs sOs
Maru vs Ryung
Kung Fu Cup
5 days
WardiTV Korean Royale
5 days
BSL 21
6 days
JDConan vs Semih
Dragon vs Dienmax
Tech vs NewOcean
TerrOr vs Artosis
Wardi Open
6 days
Monday Night Weeklies
6 days
Liquipedia Results

Completed

Proleague 2025-11-07
Stellar Fest: Constellation Cup
Eternal Conflict S1

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
SOOP Univ League 2025
YSL S2
BSL Season 21
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual

Upcoming

SLON Tour Season 2
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
HSC XXVIII
RSL Offline Finals
WardiTV 2025
RSL Revival: Season 3
META Madness #9
BLAST Bounty Winter 2026
BLAST Bounty Winter 2026: Closed Qualifier
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
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 © 2025 TLnet. All Rights Reserved.