|
-
Dec 14th, 2001, 12:17 AM
#1
Thread Starter
Lively Member
Winsock Problems
Im just bearly getting use to using VC++ and was woundering if any of you could help me. Im making a program. A simple one. that should connect to itself and send a message when it does. I have turned my winsock to a veriable (m_winsock1) and I Try to use the command m_winsock1.connect("127.0.0.1", 1234); And of course I get an error when comiling.
error C2664: 'Connect' : cannot convert parameter 1 from 'char [10]' to 'const struct tagVARIANT &'
Reason: cannot convert from 'char [10]' to 'const struct tagVARIANT'
No constructor could take the source type, or constructor overload resolution was ambiguous
Any hints?
-
Dec 14th, 2001, 08:24 PM
#2
Thread Starter
Lively Member
-
Dec 16th, 2001, 12:33 AM
#3
Thread Starter
Lively Member
What? did I post this on the wrong forum or something?
-
Dec 16th, 2001, 12:49 AM
#4
As far as I can tell, you are trying to pass a string into a function that wants a VARIANT. C++ VARIANTS do not work like VB ones, with automatic type conversion. You must load the string into a VARIANT first, then use a conversion function to pass into the function.
Z.
-
Dec 16th, 2001, 06:36 AM
#5
Monday Morning Lunatic
Variants aren't even intrinsic to C++.
The closest it has is a union, but that still assumes you know what type you're reading out of it - it won't convert for you.
VARIANT is part of COM, I think (it's there for pointerless languages I think).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Dec 17th, 2001, 03:22 PM
#6
Fanatic Member
i couldn't get winsock to work on my comp
i followed a few tutorials, try this:
Code:
//i think this is how it goes
char cIP[4]={'127','0','0','1'};
unsigned short sPort = 1234;
try passing the parameters using those names, because i did it that way, and it didnt give me any problems.
Visit www.fragblast.com
Gaming, forums, and a online RPG/Battle system
(__Flagg) DOT NET? is this a Hindi Dating service?
-
Dec 18th, 2001, 01:57 PM
#7
Thread Starter
Lively Member
cogman
thanx. I had my bro come and try and figure it out. we decided it would be easier to do it the c++ way and not the VB way.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|