Thread: Basic port scanner code .. pls help ???

  1. #16
    Just one more wrong move. -KEN-'s Avatar
    Join Date
    Aug 2001
    Posts
    3,227
    Threads are insanely easy..
    Code:
    #include <process.h>
    #include <windows.h>
    #include <conio.h>
    #include <iostream>
    
    using namespace std;
    
    bool flag=false;
    
    void DoSomething(PVOID)
    {
    	while(!kbhit());
    	
    	flag = true;
    }
    int main(void)
    {	
    	_beginthread(DoSomething, 0, NULL);
    
    	while(!flag)
    		cout<<"Threads..."<<endl;
    
    	return 0;
    }
    [snip_from_other_one_of_my_posts]
    You're going to need to enable Mutli-Threading for this to work...
    In MSVC (Visual Studio), go to Project->Settings->Click the C++ tab. Change the "Category" dropdown box to "Code Generation", and then change the "Use run-time library" dropdown box to "Multithreaded" or "Debug Mutithreaded".[/snip]

  2. #17
    Registered User intruder's Avatar
    Join Date
    Nov 2002
    Posts
    48
    hey many many thanks for the sample code ken but i am using DevC++ 4.0 , so in that what should i change so that i can compile the above sample code and test , to see the results .. pls help .. i will be very thankful to u ..

    waiting..

  3. #18
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    You just have to link to the right lib, From MSDN:

    LIBCMT.LIB Multithread static library, retail version
    MSVCRT.LIB Import library for MSVCRT.DLL, retail version

  4. #19
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Wow, this threads a bit old....

    Please don't drag up old threads.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual Basic Code Help
    By Slinger137 in forum Windows Programming
    Replies: 9
    Last Post: 01-04-2009, 10:26 AM
  2. FTP program
    By jakemott in forum Linux Programming
    Replies: 14
    Last Post: 10-06-2008, 01:58 PM
  3. Newbie needing help with basic code!
    By TeZ258 in forum C++ Programming
    Replies: 4
    Last Post: 11-03-2007, 08:35 PM
  4. Binary Search Trees Part III
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-02-2004, 03:00 PM
  5. Pls help me to do this project in C I need source code
    By sureshmenon74 in forum C Programming
    Replies: 4
    Last Post: 10-04-2001, 06:57 AM