[QUOTE=Protocol7;40573378][url]http://www.cplusplus.com/doc/tutorial/pointers/[/url][/QUOTE]
Yeah i started learning on that site , but i got stuck on pointers..
[QUOTE=Mipje;40573221]Could anyone point me out how pointers work in c++ ?[/QUOTE]
What do you not understand?
[QUOTE=Asgard;40573610]What do you not understand?[/QUOTE]
Well a friend explained how they work , but i dont really see the use of them.
[QUOTE=Mipje;40573711]Well a friend explained how they work , but i dont really see the use of them.[/QUOTE]
When using a reference as an argument, you can pass variables and change them directly without needing to return a value. So instead of passing copies of variables, you'd be sending the memory address of variables, preventing a copy having to be made every time. This is especially true for objects of classes, and classes that then contain more objects, which have to be reinstantiated.
There are much more uses for pointers, but none as common as that. Basic rule for passing by reference by the way, is to pass by reference on all non-generic types.
[QUOTE=Mipje;40573711]Well a friend explained how they work , but i dont really see the use of them.[/QUOTE]
You'll often need them when you need to store a polymorphic object.
You can't use a reference, because you don't want to reference it, you want to store it.
You can't just use a value-type, because the concrete instance is unknown at run-time.
Or when you need something to live beyond the scope where it was created, you can't use the stack but must create it on the heap, so you will need a pointer to that (since otherwise it would be on the stack).
Using a reference is unwise, since you (usually?!) don't delete (free) a reference.
You cannot re-assign a reference (since the operator= would just "fall through" to assigning the object, not the reference itself), so you will need a pointer there, too.
Then can also be useful for optional arguments if overloading is cumbersome or return-values (although boost::optional and soon std::optional).
The vast majority of the time I use pointers I use them for lists.
[QUOTE=Zinayzen;40574056]The vast majority of the time I use pointers I use them for lists.[/QUOTE]
The vast majority of time I use pointers I'm programming in Java :v:
I'm pretty new to SQL, but I'd like to be able to start doing SQL integration between various different databases I have.
In this case, I have a GlobalRanks database, where if you donate via a webpage, it will automatically give you your rank in Garry's Mod. All donation tiers are monthly, and operate via subscription.
Now where I get confused, is how to be able to integrate those values with my MyBB forum user ranks. I want to be able to have a Crontab probably check daily to see if a user's steamid on the forum still has the donator rank from the GlobalRanks database, and add them/remove them from the Donator usergroup depending on if they still have that global rank on our servers.
How would I go about doing this? sure, I could just keep a tab of who is a donator, and manually add/remove them, but that's a pain in the butt and we're trying to go all automatic for the sake of hassle and waiting times.
I need to run an executable on every .PNG file in a directory and have it output the results in another directory with their original names unchanged.
The executable is a command line tool. It has only three launch parameters that I know of, only two of which should be relevant in this case. The two that matter are "-input <input file>" and "-output <output file>".
Can this be done with a batch file?
[url]http://stackoverflow.com/questions/180741/how-to-do-something-to-each-file-in-a-directory-with-a-batch-script#180749[/url]
If this outputs relative paths, then this should be easy.
Hi.
I'm making a physics simulation of sorts in SFML (C#).
I want to have a WinForms window (for controls) and a SFML window (for the simulation) at the same time, kinda like this:
[T]http://shrani.si/f/D/jW/2IfEMyYf/brez-naslova.png[/T]
The problem is that when I start the "gameloop" of the SFML Window from the WinForms one, the WinForms window freezes (duh...).
How would I go about fixing that? I tried runnig the gameloop in a separate thread, like this:
[CODE]
private void button1_Click( object sender, EventArgs e ) {
Thread t = new Thread( new ThreadStart( game.GameLoop ) );
t.Start();
}
[/CODE]
But then nothing was showing in the SFML window... (I suspect there can only be one GUI thread?)
[QUOTE=nicholsml;40577781]I'm pretty new to SQL, but I'd like to be able to start doing SQL integration between various different databases I have.
In this case, I have a GlobalRanks database, where if you donate via a webpage, it will automatically give you your rank in Garry's Mod. All donation tiers are monthly, and operate via subscription.
Now where I get confused, is how to be able to integrate those values with my MyBB forum user ranks. I want to be able to have a Crontab probably check daily to see if a user's steamid on the forum still has the donator rank from the GlobalRanks database, and add them/remove them from the Donator usergroup depending on if they still have that global rank on our servers.
How would I go about doing this? sure, I could just keep a tab of who is a donator, and manually add/remove them, but that's a pain in the butt and we're trying to go all automatic for the sake of hassle and waiting times.[/QUOTE]
I'm not sure which part you have a problem with as you're already on the right track.
[QUOTE=E-102 Gamma;40578170]I need to run an executable on every .PNG file in a directory and have it output the results in another directory with their original names unchanged.
The executable is a command line tool. It has only three launch parameters that I know of, only two of which should be relevant in this case. The two that matter are "-input <input file>" and "-output <output file>".
Can this be done with a batch file?[/QUOTE]
[url]http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-in-batch-file[/url]
Yes, program parameters tends to be a tricky one to learn at first.
Why are my fonts not loading correctly with SFML?
It always returns 0xA, I've tried everything!
[code]
if(!font.loadFromFile("arial.ttf"))
return 0xA;
[/code]
[QUOTE=ollie;40585237]Why are my fonts not loading correctly with SFML?
It always returns 0xA, I've tried everything!
[code]
if(!font.loadFromFile("arial.ttf"))
return 0xA;
[/code][/QUOTE]
That will be looking for the file in your working directory (usually either the directory containing the .exe file, or your project directory if you're running from visual studio or another IDE.) If you haven't put the font there, it won't find it.
[QUOTE=Chris220;40585290]That will be looking for the file in your working directory (usually either the directory containing the .exe file, or your project directory if you're running from visual studio or another IDE.) If you haven't put the font there, it won't find it.[/QUOTE]
I have the font file in the same directory as my .exe.
What would the project directory be? I'm using VC++2010
[QUOTE=ollie;40585334]I have the font file in the same directory as my .exe.
What would the project directory be? I'm using VC++2010[/QUOTE]
Anything in the console window?
[QUOTE=ollie;40585334]I have the font file in the same directory as my .exe.
What would the project directory be? I'm using VC++2010[/QUOTE]
Try putting it in the project folder. If your project was called "HelloWorld", then the project folder would be "HelloWorld\HelloWorld".
If you're debugging from Visual Studio, the working directory is:
<VC projects>\<Solution name>\<Project name>
If you're running the executable directly, the working directory is the folder where the executable is
Also you should make sure the case is correct. It shouldn't matter on Windows, but SFML is multi-platform and many platforms are case-sensitive about file names.
[QUOTE=Chris220;40585623]Try putting it in the project folder. If your project was called "HelloWorld", then the project folder would be "HelloWorld\HelloWorld".[/QUOTE]
[QUOTE=ThePuska;40585669]If you're debugging from Visual Studio, the working directory is:
<VC projects>\<Solution name>\<Project name>
If you're running the executable directly, the working directory is the folder where the executable is
Also you should make sure the case is correct. It shouldn't matter on Windows, but SFML is multi-platform and many platforms are case-sensitive about file names.[/QUOTE]
Thanks, It works now.
Also how can I bring up the console window? I remember I had it open on my other project but with this it doesn't appear anywhere, just the sfml window.
(In C#)
I want to take a string and convert the letters to individual ASCII values and vice versa, how do I do that?
[QUOTE=ollie;40585857]Thanks, It works now.
Also how can I bring up the console window? I remember I had it open on my other project but with this it doesn't appear anywhere, just the sfml window.[/QUOTE]
Did you create a Windows application or a Console application? If you make a Console application you get the console and then you initiate a new window for SFML next to it.
If you use "int main()" as your entry point, and set your project subsystem to /SUBSYSTEM:CONSOLE then you can get a console to appear as well as your window. I usually have my projects set up to do this in debug mode, and have no console in release mode.
[QUOTE=JohanGS;40586326](In C#)
I want to take a string and convert the letters to individual ASCII values and vice versa, how do I do that?[/QUOTE]
Byte[] bytes = System.Text.Encoding.ASCII.GetBytes(theString);
And
String text = System.Text.Encoding.ASCII.GetString(bytes);
Does anyone know a good way for two developers to edit a secure (no one can get the code and leak it) source code online or something? Because it's becoming an annoying hassle to have to take sessions of coding, uploading the latest code to the ftp, having them dl it, wait for them to make their edits, then uploading it back to the ftp back and forth etc etc.
Sorry for the noobish type question, thanks guys!
Can someone who is proficient with Java help me out understanding doing a java problem?
[QUOTE=KamenMoore;40590666]Does anyone know a good way for two developers to edit a secure (no one can get the code and leak it) source code online or something? Because it's becoming an annoying hassle to have to take sessions of coding, uploading the latest code to the ftp, having them dl it, wait for them to make their edits, then uploading it back to the ftp back and forth etc etc.
Sorry for the noobish type question, thanks guys![/QUOTE]
You can use a [URL="https://en.wikipedia.org/wiki/Distributed_revision_control"]DVCS[/URL] for that (and should use one anyway, always). Either use a host like Bitbucket or GitHub or set up your server.
[editline]10th May 2013[/editline]
[QUOTE=pyschomc;40590869]Can someone who is proficient with Java help me out understanding doing a java problem?[/QUOTE]
Sure, so what is that Java problem, then?
[QUOTE=Tamschi;40591370]You can use a [URL="https://en.wikipedia.org/wiki/Distributed_revision_control"]DVCS[/URL] for that (and should use one anyway, always). Either use a host like Bitbucket or GitHub or set up your server.
[editline]10th May 2013[/editline]
Sure, so what is that Java problem, then?[/QUOTE]
Private GitHub repo's cost money though.
[QUOTE=mobrockers2;40592753]Private GitHub repo's cost money though.[/QUOTE]
Then Bitbucket, they are free there for up to 5-8 users each, depending on how many users you invite.
[QUOTE=Tamschi;40592853]Then Bitbucket, they are free there for up to 5-8 users each, depending on how many users you invite.[/QUOTE]
One alternative is [url=http://tfs.visualstudio.com/en-us/]Team Foundation Service[/url] as they recently added Git support. Limited to 5 users, has a few nice things like building if you're targeting Windows or Java.
Sorry, you need to Log In to post a reply to this thread.