Solved

C under UNIX

Posted on 1999-01-19
2
163 Views
Last Modified: 2010-03-18
In C, a the function connect() returns a non-zero integer on success and a negative integer on error, placed inside errno! I want to know how to view the error returned as a string using the system function strerror() or its equivalent!!
0
Comment
Question by:boosta
2 Comments
 
LVL 10

Accepted Solution

by:
rbr earned 50 total points
ID: 1588146
if (connect(sockfd,pserv_addr,addrlen ) < 0)
      printf ("Error: %s",strerror (errno));

0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 1588147
or simply:
perror("prefix to message" );
0

Featured Post

Scale it in WD Gold

With up to ten times the workload capacity of desktop drives, WD Gold hard drives employ advanced technology to deliver among the best in reliability, capacity, power efficiency and performance.

Question has a verified solution.

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

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

862 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now