• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 16:26
CET 22: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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies3ComeBackTV's documentary on Byun's Career !11Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2
StarCraft 2
General
ComeBackTV's documentary on Byun's Career ! Team TLMC #5: Winners Announced! What's the best tug of war? The Grack before Christmas Weekly Cups (Dec 15-21): Classic wins big, MaxPax & Clem take weeklies
Tourneys
OSC Season 13 World Championship $5,000+ WardiTV 2025 Championship $100 Prize Pool - Winter Warp Gate Masters Showdow Sparkling Tuna Cup - Weekly Open Tournament Winter Warp Gate Amateur Showdown #1
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 505 Rise From Ashes Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement
Brood War
General
BW General Discussion How soO Began His ProGaming Dreams Klaucher discontinued / in-game color settings BGH Auto Balance -> http://bghmmr.eu/ Recommended FPV games (post-KeSPA)
Tourneys
[Megathread] Daily Proleagues [BSL21] LB SemiFinals - Saturday 21:00 CET [BSL21] WB & LB Finals - Sunday 21:00 CET Small VOD Thread 2.0
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Nintendo Switch Thread Mechabellum Stormgate/Frost Giant Megathread Beyond All Reason 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
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread 12 Days of Starcraft The Games Industry And ATVI Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List TL+ Announced Where to ask questions and add stream?
Blogs
National Diversity: A Challe…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1476 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 States17274 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 States17274 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 States17274 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
BSL 21
20:00
LB SemiFinal
Sziky vs eOnzErG
ZZZero.O208
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
IndyStarCraft 203
DisKSc2 44
Railgan 32
StarCraft: Brood War
Shuttle 616
ZZZero.O 208
Dewaltoss 138
JulyZerg 45
910 32
Dota 2
syndereN354
Counter-Strike
fl0m1408
pashabiceps1119
Heroes of the Storm
Liquid`Hasu438
Khaldor212
Other Games
Grubby6068
tarik_tv2593
Beastyqt859
B2W.Neo331
ToD280
RotterdaM231
ArmadaUGS133
XaKoH 110
ViBE1
Organizations
Other Games
gamesdonequick1334
StarCraft 2
angryscii 36
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 18 non-featured ]
StarCraft 2
• StrangeGG 64
• printf 61
• davetesta47
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• intothetv
• Kozan
• sooper7s
• LaughNgamezSOOP
StarCraft: Brood War
• 80smullet 16
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• WagamamaTV1251
• Ler86
League of Legends
• Stunt236
Other Games
• imaqtpie2692
Upcoming Events
Sparkling Tuna Cup
12h 34m
Krystianer vs Classic
TriGGeR vs SKillous
Percival vs Ryung
ByuN vs Nicoract
OSC
20h 34m
BSL 21
22h 34m
Cross vs Dewalt
Replay Cast
1d 11h
Wardi Open
1d 14h
OSC
2 days
Solar vs MaxPax
ByuN vs Krystianer
Spirit vs TBD
OSC
5 days
Korean StarCraft League
6 days
OSC
6 days
OSC
6 days
Liquipedia Results

Completed

Escore Tournament S1 - W1
WardiTV 2025
META Madness #9

Ongoing

C-Race Season 1
IPSL Winter 2025-26
BSL Season 21
CSL Season 19: Qualifier 2
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025

Upcoming

CSL 2025 WINTER (S19)
Escore Tournament S1 - W2
Escore Tournament S1 - W3
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.