Solved

cannot convert from 'long' to 'LONG *'

Posted on 2004-09-01
1
349 Views
Last Modified: 2012-05-05
I have code below, when i build solution, i get error
error C2440: '=' : cannot convert from 'int' to 'LONG *'
because rep.nbUsersLigne is an INT

how can i convert rep.nbUsersLigne INT to Result LONG*
also,
how can i convert rep.nbUsersLigne LONG to Result LONG*

StreamClient(long UserId, LONG* Result)
{
      ...
      Result=rep.nbUsersLigne;
}

STDMETHODIMP CCom::ADD(LONG UserId, LONG* Result)
{
      StreamClient("SERVERNAME", SERVERPORT, UserId, "ADD","", Result);

      return S_OK;
}
0
Comment
Question by:mammouth
1 Comment
 
LVL 86

Accepted Solution

by:
jkr earned 50 total points
ID: 11956519
Try

StreamClient(long UserId, LONG* Result)
{
   // ...
    *Result=rep.nbUsersLigne;
}

This way you will store the value of rep.nbUsersLigne in the LONG variable Result points to.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

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. …
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
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.

770 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