?
Solved

cannot convert from 'long' to 'LONG *'

Posted on 2004-09-01
1
Medium Priority
?
390 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 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
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. …
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.
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.
Suggested Courses

850 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