I am a new learner of c. I am trying to code a car game .I have some problems in it .
In this,the car is moving separately according to the input .The random cars are generated.I am not able to combine both the functions simultaneously. could any one help me how to create thread ..........
raj.sokkalingam
0
Newbie Poster
Recommended Answers
Jump to PostIn many cases threads complicate matters before they solve them - especially if you are unfamiliar with threading in general.
Why not have some discrete concept of time where you invoke each behavior at each step? Something like:while (true) { has_input = check_for_input if (has_input) apply_input …
Jump to PostOR you can just always thread.
On Linux you can use fork().
On windows call CreateThread(), something like this:#include <windows.h> #include <iostream> DWORD CALLBACK threadFunc(void*) { printf("New Thread"); return 0; } int main(int argc, const char* argv[]) { DWORD id; HANDLE h = CreateThread(NULL, 0, threadFunc, NULL, …
All 7 Replies
L7Sqr
227
Practically a Master Poster
sDJh
commented:
true
+6
pseudorandom21
166
Practically a Posting Shark
raj.sokkalingam
0
Newbie Poster
sergent
52
Posting Pro
raj.sokkalingam
0
Newbie Poster
pseudorandom21
166
Practically a Posting Shark
sergent
commented:
..
+5
sergent
52
Posting Pro
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.