473,794 Members | 2,774 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error compiling with read function

Hi,
I have this thread function:
//handle one socket connection thread
DWORD WINAPI SocketHandler(L PVOID lpvParam)
{
int socketNumber=*( DWORD*)lpvParam ; //the socket number
int n;
char end_connection[]={"$Exit$\n"} ; //end connection message
char buffer[BUFSIZE];

n = read(socketNumb er,buffer,BUFSI ZE);
if (n < 0) //error reading
exit(1); //exit thread

while(strcmp(bu ffer,end_connec tion)) //until end connection has
reached
Message* x=new Message(buffer) ;

return 0;
}

for some reason I get the following error :
error C3861: 'read': identifier not found, even with argument-dependent
lookup

this happens using vs.net 2003 enviroment for win32 console
application.
I have the following declerations at the top of the file:
#include <iostream>
#include <winsock.h>
#include <windows.h>
#include "Message.h"
#include "MessageQueue.h "

using namespace std;
#pragma comment(lib, "ws2_32.lib ")

Any idea what the problem might be ?

Jan 9 '06 #1
4 2888
Shlomy Shivek wrote:
Hi,
I have this thread function:
//handle one socket connection thread
DWORD WINAPI SocketHandler(L PVOID lpvParam)
{
int socketNumber=*( DWORD*)lpvParam ; //the socket number
int n;
char end_connection[]={"$Exit$\n"} ; //end connection message
char buffer[BUFSIZE];

n = read(socketNumb er,buffer,BUFSI ZE);
if (n < 0) //error reading
exit(1); //exit thread

while(strcmp(bu ffer,end_connec tion)) //until end connection has
reached
Message* x=new Message(buffer) ;

return 0;
}

for some reason I get the following error :
error C3861: 'read': identifier not found, even with argument-dependent
lookup

this happens using vs.net 2003 enviroment for win32 console
application.
I have the following declerations at the top of the file:
#include <iostream>
#include <winsock.h>
#include <windows.h>
#include "Message.h"
#include "MessageQueue.h "

using namespace std;
#pragma comment(lib, "ws2_32.lib ")

Any idea what the problem might be ?


This question is off-topic here since it doesn't deal with the standard
language or libraries proper. See the FAQ for what is on-topic and for
some suggestions of better places to post:

http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Cheers! --M

Jan 9 '06 #2
Shlomy Shivek wrote:
Hi,
I have this thread function:
//handle one socket connection thread
DWORD WINAPI SocketHandler(L PVOID lpvParam)
{
int socketNumber=*( DWORD*)lpvParam ; //the socket number
int n;
char end_connection[]={"$Exit$\n"} ; //end connection message
char buffer[BUFSIZE];

n = read(socketNumb er,buffer,BUFSI ZE);
if (n < 0) //error reading
exit(1); //exit thread

while(strcmp(bu ffer,end_connec tion)) //until end connection has
reached
Message* x=new Message(buffer) ;

return 0;
}

for some reason I get the following error :
error C3861: 'read': identifier not found, even with argument-dependent
lookup

Any idea what the problem might be ?


Well, all I can tell you is the same as the compiler.

read is not declared.

Read the API for your library, or ask in a more appropriate place.
Presumably you have the wrong argument types, or have not included the
correct header.

Ben Pope
--
I'm not just a number. To many, I'm known as a string...
Jan 9 '06 #3

"Shlomy Shivek" <sh**********@g mail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Hi,
I have this thread function:
//handle one socket connection thread
DWORD WINAPI SocketHandler(L PVOID lpvParam)
{
int socketNumber=*( DWORD*)lpvParam ; //the socket number
int n;
char end_connection[]={"$Exit$\n"} ; //end connection message
char buffer[BUFSIZE];

n = read(socketNumb er,buffer,BUFSI ZE);
if (n < 0) //error reading
exit(1); //exit thread

while(strcmp(bu ffer,end_connec tion)) //until end connection has
reached
Message* x=new Message(buffer) ;

return 0;
}

for some reason I get the following error :
error C3861: 'read': identifier not found, even with argument-dependent
lookup

this happens using vs.net 2003 enviroment for win32 console
application.
I have the following declerations at the top of the file:
#include <iostream>
#include <winsock.h>
#include <windows.h>
#include "Message.h"
#include "MessageQueue.h "

using namespace std;
#pragma comment(lib, "ws2_32.lib ")

Any idea what the problem might be ?


I beleive you want recv, not read.
Jan 12 '06 #4
That is right, thanks!

Jan 13 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1631
by: PiErre | last post by:
Hi All, I am trying to install win32 extension 162 on python 2.2.3 on a virtual (vmware) machine with win2k server sp3 (but I tested that the same happens on either win2k sp2 or win2ksp3 on a real biprocessor). I keep getting the drwatson error reported below during win32all 162 installation (during the compiling step, near the end of the progression bar - it can pass unnotice, but some symptoms are that you don't have a finish button -...
8
7838
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the VALUE ENTERED BY THE USER EXISTS IN THE DB , then THE ERROR MESSAGE OF THE COMPARE VALIDATOR SHOULD BE DISPLAYED. For this, I used the reference artiicle "http://msdn.microsoft.com/library/default.asp?url=/library/en-...
12
2539
by: mast2as | last post by:
Hi everyone... I have a TExceptionHandler class that is uses in the code to thow exceptions. Whenever an exception is thrown the TExceptionHander constructor takes an error code (int) as an argument. I was hoping to create a map<int, const char*that would be used in the showError member function of the TExceptionHandler class where the key (int) would be the error code and const char* the message printed out to the console. My question...
2
3384
by: teddybyte | last post by:
my script below is: #include "stdafx.h" int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
2
5334
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: 1>make_buildinfo.obj : error LNK2019: unresolved external symbol __imp__RegQueryValueExA@24 referenced in function _make_buildinfo2 Ask on python-list@python.org . - Josiah
2
3267
by: 001 | last post by:
I get the following error when compiling under MS VC++: ------ Build started: Project: pract-1, Configuration: Debug Win32 ------ Compiling... pract-1.cpp Linking... atlsd.lib(atltrace.obj) : error LNK2005: "unsigned int (__stdcall* ATL::g_pfnGetThreadACP)(void)" (?g_pfnGetThreadACP@ATL@@3P6GIXZA) already defined in iorw-vc7.lib(iorw-vc7-dll.obj)
7
3111
by: JustBeSimple | last post by:
Hi Everyone, I'm having a problem compiling useing the VS2005 .NET I need help to resolve those error, I try to create a new project it doesn't help any suggestion? I got the following errors: vector_main.obj : error LNK2019: unresolved external symbol "public: __thiscall Vector<int>::~Vector<int>(void)" (??1?$Vector@H@@QAE@XZ) referenced in function _main
1
5326
by: sahilrekhi | last post by:
Hi i am working on a graphical user interface deisgn programme. when i compile the file i i get the following output with the mentioned errors: 1>------ Rebuild All started: Project: guiq, Configuration: Debug Win32 ------ 1>Deleting intermediate and output files for project 'guiq', configuration 'Debug|Win32' 1>Compiling... 1>stdafx.cpp 1>Compiling... 1>Custom Message.cpp 1>guiq.cpp 1>Generating Code...
8
1949
by: jadamwil | last post by:
Hello, I am using the numpy fromfile function to read binary data from a file on disk. The problem is that the program runs fine on a Mac, but gives an error or warning on windows when trying to read the data. I use it like this: Signal = zeros((N, 16), dtype=float32) for sample in range(0, N): # this function gets the next position in the file to seek to s = getFilePos(sample)
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9037
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6779
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.