Quick Threading Tutorial - C++
Programming
|
Threading In C++, By Otoom
Hello, I will show you how to thread in C++.
First you need to create the thread, so if we place this into our editor...
Okay, and that is the basic layout.
Now we have declared the thread, of course change Threadname to whatever you would like to call it.
What we can now do is, call on that thread within the main.
So if we add a little bit of code...
Okay, so, What have we done here?
What we have now done is call upon the thread we declared. Using a handle.
But after all this, i bet you think what can threads even do.
Okay well. Threads let you run something else while running main.
It is like a background running program but within the same application.
For example.
We can show the lyrics of a song, while making the beeps of it.
I hope you get that.
So... Now.
[code]DWORD WINAPI Beeps (LPVOID lpData)
{
while(1)
{
cout<<"\a";
}
}
int main()
{
HANDLE Beeps = CreateThread(NULL, 0, Beeps, NULL, 0 View In Full
 |
2 Comments |
6.00 out of 10 |
|
|
First look at C
Programming
|
First time with C, Otoom
DoxCoding.com
Components
------------------------
Code::Blocks
Windows
------------------------
Contents
------------------------
Who this is aimed at
A first look
Variables
Functions
------------------------
Who this is aimed at.
This, as it says, First time with C.
This does not need any prior knowledge of C, or as that happens any other programming language.
Do not be put off, if you have not programmed / coded in your life, as i will be trying my best on this one
to keep you happy, and knowing what you are doing every step.
Best of all. You must enjoy it, you must also practice each chapter as it goes. If you think you can pick it up
just by looking at it, it's a mistake. Many people have done that before, and found they do really have to practice.
So... threee rules, practice, practice and practice.
A first look.
Okay, well lets get started on this one. A first look will quickly take you through a quick few... View In Full
 |
3 Comments |
7.50 out of 10 |
|
|
Cheat Sheet Pack
Other
|
DoxCoding.com
Well, i have posted a cheat sheet in about every language board on the forums.
So.. I thought i would gather them together and make a sort of, Pack
I hope you guys enjoy this.
CSS
http://www.ilovejackdaniels.com/css_cheat_sheet.pdf
http://lesliefranke.com/files/reference/csscheatsheet.html
http://home.tampabay.rr.com/bmerkey/cheatsheet.htm
HTML
http://www.ilovejackdaniels.com/html-cheat-sheet.pdf
http://www.killersites.com/HTML_CODES/index.jsp
Javascript
http://www.ilovejackdaniels.com/javascript_cheat_sheet.pdf
PHP
http://www.ilovejackdaniels.com/php_cheat_sheet.pdf
Perl/CGI
http://juerd.nl/site.plp/perlcheat
http://www.catonmat.net/blog/wp-content/plugins/wp-downloadMonitor/user_uploads/perl.predefined.variables.pdf
ASP/VBScript
http://www.ilovejackdaniels.com/asp_cheat_sheet.pdf
C++
http://www.dreamincode.net/downloads/ref_sheets/cpp_reference_sheet.pdf
Delphi
http://www.explainth.at/downloads/dquick.pdf... View In Full
 |
4 Comments |
8.00 out of 10 |
|
|
[PHP] How to make a log file.
Programming
|
DoxCoding.com
Well, this will be more like a walk through, rather than a tutorial / article, Whatever.
So, to make a log file, we need to use a great language, server sided, called PHP.
PHp is a very powerful server side language.
So, to get started.
We will make some declarations.
Well, that is the basic declarations.
I have commented them to help you on what they are / mean. Rather than explaining each of them.
Okay, lets move swiftly on.
We need to open the log file, print in the information, every time someone visits that log file.
So, lets do it.
Again, nice an simple. Commented work.
[code]
$open = fopen($file, "a+"); //open the file, (log.htm).
fwrite($open, "<b>IP Address:</b> &q View In Full
 |
3 Comments |
6.00 out of 10 |
|
|
HTML Cheat Sheet!
Programming
|
DoxCoding.com
Basic Tags
<html></html>
Creates an HTML document
<head></head>
Sets off the title and other information that isn't displayed on the Web page itself
<body></body>
Sets off the visible portion of the document
Header Tags
<title></title>
Puts the name of the document in the title bar
Body Attributes
<body bgcolor=?>
Sets the background color, using name or hex value
<body text=?>
Sets the text color, using name or hex value
<body link=?>
Sets the color of links, using name or hex value
<body vlink=?>
Sets the color of followed links, using name or hex value
<body alink=?>
Sets the color of links on click
Text Tags
<pre></pre>
Creates preformatted text
<hl></hl>
Creates the largest headline
<h6></h6>
Creates the smallest headline
<b></b>
Creates bold text
<i></i>
Creates italic text
<tt></tt>
Creates teletype, or typewriter-style text
<cite></cite>
Creates a citation, usually italic
<em></em>
Emphasizes a word (with italic or bol... View In Full
 |
0 Comments |
7.33 out of 10 |
|
|
[C++] Comments
Programming
|
DoxCoding.com
Now this is easy to understand. I dont even have to explain. But i will just incase.
So. These comments are used in most programming languages. NOT all but i said most.
So first of all i will explain the single line comment.
This is simple. It is basicly explained within the name.
The single line comment looks something like this:
// This is a single line comment.
Single line comments end at the end of the line. Comments are TOTALLY ignored by your C++ compiler. Meaning it is not read in as input OR output and will not make a difference in your C++ project.
Why are comments good?
Well comments are good if you stop codingh for a while. Or become lazy and pospone a project you are making. These comments then come in handy to remind you what you were doing. Do NOT comment the hell out of it. Its not normally for what its doing. Its for how it is doing it.
Ok onto the next comment.
A multi line comment.
It looks similar to this:
/*
Th... View In Full
 |
0 Comments |
2.50 out of 10 |
|
|
[C++] Functions
Programming
|
DoxCoding.com
Hello again.
This tutorial will be nice and small. THings arent too hard to explain and understand. So i will get straight into it.
main() is a function. It is a special function to a C++ program because it is the first thing to be read and performed. Any other functions that are declared are run after or because they are being called.
so once again the basic template of our C++ programs. Can you still remember it?
#include <iostream>
using namespace std;
int main() //wow look a function!
{
}
Ok we need to change this alittle before we can start. The normaly template will now change slightly, (not for all the rest of the tutorials just this one!).
Ok. So. Lets change it to what is needed.
#include <iostream>
using namespace std;
void function()
{
}
int main()
{
}
Well that is know done. I bet you are thinking to yourself what the hell does that mean.
I will explain both types of function, void and int.... View In Full
 |
0 Comments |
2.50 out of 10 |
|
|
[C++]Taking In User Input,
Programming
|
DoxCoding.com
Ok so i now hope you have a small understanding how the Hello World Program works.
So you know how to print out output, but do you know how to take in user input. Didnt think so....
Well here i will teach you a little on how to do so.
So lets start.
The simple hello world was.
#include <iostream>
using namespace std;
int main()
{
cout<<"Hello, World!";
return 0;
}
So lets move on from this basic application and take in some user input.
First we need to give out some output to ask for the input.
so lets begin.
Lets go for it.
#include <iostream>
using namespace std;
int main()
{
}
Ok now. We have all the parts we need. (Most of the programs in the rest of articles (if i do anymore) will be using this simple layout to begin. So lets give the output.
#include <iostream>
using namespace std;
int main()
{
cout<<"Enter a number";
}
Ok we have said Enter a number. Simple isnt it. But it... View In Full
 |
0 Comments |
8.67 out of 10 |
|
|
Your First C++ Program
Programming
|
DoxCoding.com
Ok the best way to start is to tell you what we will do ;).
Ok. First we will be using:
-------------------------------------
Dev-CPP. (Type this in google to download it).
A Brain. (Vital)
-------------------------------------
Ok so i think we should really get started.
So lets start with a simple hello world application.
Ok to start this we can simply open Dev-CPP, File > New > Source Code. We can type all our code in there. Projects will come later if i do something thats neeeded. By all means if you want to use a new project you may.
So. the hello world.cpp
#include <iostream>
using namespace std;
int main()
{
cout << "Hello, World! \n";
system("PAUSE");
return 0;
}
Ok, so i guess you havent a clue on what any of this means do you?
This is what i am here for. To explain your first C++ program.
Lets start off with the first line of code.
#include <iostream> .
Lines beginning with a sign (#) are direct... View In Full
 |
0 Comments |
7.67 out of 10 |
|
|
|
 |
Ant (17) United Kingdom, West Midlands |
|
otoom has 8 fans
become a fan |
|
 |
|
 |
|