472,952 Members | 2,092 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,952 software developers and data experts.

write function ?

Hi,
I'm trying to understand a small cpp program which uses a function called
write.
An example of a line using this function is
write (hsocket,strclose,strlen(strclose)); where strclose is a string to
write, and hsocket is a int containing a socket handle.
The cpp program headers are
#include <iostream>
#include <string.h>
#include <sys/stat.h>
using namespace std;
and an included netfunc.h containing prototypes for various c sockets
functions in a netfunc.c program (but NOT write).

This write function must be the sockets write function ? But how does this
function compile correctly in this case ? It's a c function in a cpp file ?
Thanks
Tony
Feb 6 '07 #1
1 3478
Tony B wrote:
Hi,
I'm trying to understand a small cpp program which uses a function called
write.
An example of a line using this function is
write (hsocket,strclose,strlen(strclose)); where strclose is a string to
write, and hsocket is a int containing a socket handle.
The cpp program headers are
#include <iostream>
#include <string.h>
#include <sys/stat.h>
using namespace std;
and an included netfunc.h containing prototypes for various c sockets
functions in a netfunc.c program (but NOT write).

This write function must be the sockets write function ? But how does this
function compile correctly in this case ? It's a c function in a cpp file ?
Thanks
Tony

Likely it is just luck. On my system <iostreameventually include
<unistd.h>, which is where write is declared. Of course, the C++
standard doesn't guarantee that (write isn't part of the standard C++
library), and I very seriously doubt POSIX makes any such guarantee either.

--
Alan Johnson
Feb 6 '07 #2

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

Similar topics

1
by: Bob Murdoch | last post by:
I have a situation where I call a COM object from ASP that is supposed to create a file. On occasion, especially during development, the output of the COM function is an error string rather than...
9
by: James Marshall | last post by:
I'm writing a library where I want to override document.write(), but for all document objects; thus, I want to put it in the prototype. I tried Document.prototype.write= my_doc_write ; but it...
2
by: Geoff Wilkins | last post by:
I am using <SCRIPT src=...> to import a Javascript routine from a remote source. I am then using some of the variables given values in the routine, in my own Javascript.. Unfortunately the...
14
by: Eli | last post by:
I've got a script that I'm trying to debug which uses document.write() to place HTML within a page. In both IE6 and Firefox when I view source, I see only the script itself and not any HTML as...
2
by: Eric Mitchell | last post by:
Hello all, I am using the document.write() method to create new content on the same page, however... I need to create a new button using this method (button in HTML). Complicating the matter...
2
by: bissatch | last post by:
Hi, I am trying to use JavaScript to write a table column on a web page. The code is as follows: <html> <head> <script> function displaycount() {
18
by: jacob navia | last post by:
In C, we have read-only memory (const), read/write memory (normal data), and write only memory. Let's look at the third one in more detail. Write only memory is a piece of RAM that can only...
88
by: Peter Olcott | last post by:
Cab you write code directly in the Common Intermediate language? I need to optimize a critical real-time function.
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...

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.