Solved

Problem with _beginthread and Visual Studio C++.Net

Posted on 2004-03-29
2
1,459 Views
Last Modified: 2008-02-01
I have just started using the Visual Studio C++.NET.  I used to use Visual Age by IBM.  My program uses mutitasking and I can't get the _beginthread correct.

My command is "_beginthread(update_db_thread,0,(void *)thread_index);"  where update_db_thread is the name of the thread and thread_index is an integer i am passing to the thread.  

I get the following error "c:\C++\MAIS704\MAIS704.cpp(944): error C2664: '_beginthread' : cannot convert parameter 1 from 'void (int)' to 'void (__cdecl *)(void *)'.  
Do I have to cast the name or am I doing something else wrong.  ???  If so how does the cast statement look.
0
Comment
Question by:larryH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 23

Accepted Solution

by:
chensu earned 50 total points
ID: 10707812
The prototype of update_db_thread() has to be

void update_db_thread(void *pParam);

You can cast the pParam to an integer if you want.

void update_db_thread(void *pParam)
{
    int nParam = (int)pParam;
}
0
 

Author Comment

by:larryH
ID: 10708087
Thank You  
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question