![]() |
| | #1 |
| Registered User Join Date: Jan 2006 Location: Belgrade
Posts: 72
| Getting service port with getservbyname() the following code Code: int main()
{
struct servent* se = getservbyname("telnet", "tcp");
printf("%d\n", se->s_port);
}
Thanks |
| karas is offline | |
| | #2 |
| Registered User Join Date: Oct 2001
Posts: 2,110
| try converting it to host byte order. Code: printf("%d\n", ntohs(se->s_port));
|
| robwhit is offline | |
| | #3 |
| Registered User Join Date: Jan 2006 Location: Belgrade
Posts: 72
| It works, thanks. |
| karas is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| FTP program | jakemott | Linux Programming | 14 | 10-06-2008 01:58 PM |
| running my program as service | daher | Windows Programming | 5 | 09-05-2008 12:30 PM |
| brace-enclosed error | jdc18 | C++ Programming | 53 | 05-03-2007 05:49 PM |
| Segmentation Fault - Trying to access parallel port | tvsinesperanto | C Programming | 3 | 05-24-2006 03:28 AM |
| DOS, Serial, and Touch Screen | jon_nc17 | A Brief History of Cprogramming.com | 0 | 01-08-2003 04:59 PM |