Solved

Problem with _beginthread and Visual Studio C++.Net

Posted on 2004-03-29
2
1,446 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
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now