C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 02-19-2008, 11:49 PM   #1
Registered User
 
bradszy's Avatar
 
Join Date: Jan 2008
Posts: 114
2 things at once?

I was just waondering, if it was possible to do 2 things at once in a console app. Like loop the changing of console colours while still being able to do things within the application. Thanks for your time.
bradszy is offline   Reply With Quote
Old 02-19-2008, 11:54 PM   #2
CSharpener
 
vart's Avatar
 
Join Date: Oct 2006
Posts: 5,303
you can use threads or timers
__________________
If I have eight hours for cutting wood, I spend six sharpening my axe.
vart is offline   Reply With Quote
Old 02-20-2008, 12:11 AM   #3
Registered User
 
bradszy's Avatar
 
Join Date: Jan 2008
Posts: 114
Would you care to give me more of an insight on threads please?
bradszy is offline   Reply With Quote
Old 02-20-2008, 12:17 AM   #4
CSharpener
 
vart's Avatar
 
Join Date: Oct 2006
Posts: 5,303
Windows or linux?

It is platform specific - so better ask the question about threads on the platform designated forum
__________________
If I have eight hours for cutting wood, I spend six sharpening my axe.
vart is offline   Reply With Quote
Old 02-20-2008, 12:21 AM   #5
Registered User
 
bradszy's Avatar
 
Join Date: Jan 2008
Posts: 114
Ok thanks.
bradszy is offline   Reply With Quote
Old 02-20-2008, 02:56 AM   #6
Registered User
 
Join Date: Dec 2006
Location: Canada
Posts: 2,001
I believe there's a simple thread implementation in Boost, too, or Qt, both of which would make your code a lot more portable (than using win32-threads or pthreads)
cyberfish is offline   Reply With Quote
Old 02-20-2008, 01:10 PM   #7
Registered User
 
Join Date: Nov 2005
Posts: 634
There is also SDL_thread which works very well i think.
Raigne is offline   Reply With Quote
Old 02-20-2008, 01:19 PM   #8
Frequently Quite Prolix
 
dwks's Avatar
 
Join Date: Apr 2005
Location: Canada
Posts: 7,698
Yes, but you have to use the SDL to get at it, which is probably too annoying unless you're actually using the SDL in the first place.

I suggest you try pthreads, unless you want to use another library like one of those mentioned. It's reasonably portable. Search for some tutorials with Google if you're interested.
__________________
dwk

Seek and ye shall find. quaere et invenies.

"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell


Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net

My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
dwks is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Suggestions for things to study Mastadex Windows Programming 5 08-18-2008 09:23 AM
Plants that eat things StinkyRyan A Brief History of Cprogramming.com 5 07-05-2004 03:41 PM
How are things looking cyberCLoWn C++ Programming 8 01-15-2004 02:53 PM
Selecting things on the canvas Barjor Windows Programming 0 08-30-2001 02:10 PM
Help with these three things... face_master C++ Programming 2 08-26-2001 07:05 AM


All times are GMT -6. The time now is 04:53 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22