如何通过'C'程序获取我的机器的IP地址 [英] How to get the IP address of my machine through a 'C' program

查看:86
本文介绍了如何通过'C'程序获取我的机器的IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hai,

任何人都可以告诉我如何通过cprogram获取我的机器的IP地址

而不使用套接字编程。是否有任何

系统调用来获取我的机器的IP地址,该地址将用于

c程序以显示我机器的IP地址。

问候,

晴天

Hai,
Anybody can give me idea how to get the ip address of my machine
through a cprogram with out using the socket programming. Is there any
system call to get the ip address of my machine that will be used in
the c program to display the IP address of my machine.
Regards,
Sunny

推荐答案

sunny写道:
sunny wrote:

任何人都可以告诉我如何通过cprogram获取我的机器的IP地址

而不使用套接字编程。是否有任何

系统调用来获取我的机器的IP地址,该地址将用于

c程序以显示我机器的IP地址。
Anybody can give me idea how to get the ip address of my machine
through a cprogram with out using the socket programming. Is there any
system call to get the ip address of my machine that will be used in
the c program to display the IP address of my machine.



标准C中没有这样的功能。为了便携性我会猜到一些东西

POSIXy,所以请问comp。 unix.programmer可能会有所帮助(即使你在Unix机器上是
/ not /)。


-

克里斯电刺猬 Dollin

这里没有人正是他出现的。 G''kar,/ Babylon 5 /

There''s no such function in standard C. For portability I''d guess something
POSIXy, so asking in comp.unix.programmer might help (even if you''re
/not/ on a Unix box).

--
Chris "electric hedgehog" Dollin
"No-one here is exactly what he appears." G''kar, /Babylon 5/


文章< er ********** @ murdoch.hpl.hp。 com>,

Chris Dollin< ch ********** @ hp.comwrote:
In article <er**********@murdoch.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:

>晴天写道:
>sunny wrote:

>任何人都可以通过cprogram告诉我如何通过套接字编程获取我的机器的IP地址
。是否有任何
系统调用来获取我的机器的IP地址,将用于在c程序中显示我的机器的IP地址。
>Anybody can give me idea how to get the ip address of my machine
through a cprogram with out using the socket programming. Is there any
system call to get the ip address of my machine that will be used in
the c program to display the IP address of my machine.


标准C中没有这样的功能。为了便携性,我猜想有什么东西
POSIXy,所以在comp.unix.programmer中询问可能有所帮助(即使你在Unix机器上是/ / / /


There''s no such function in standard C. For portability I''d guess something
POSIXy, so asking in comp.unix.programmer might help (even if you''re
/not/ on a Unix box).



IOW:


关闭主题。不便携。不能在这里讨论它。 Blah,等等,等等。


有用的clc相关链接:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language

IOW:

Off topic. Not portable. Cant discuss it here. Blah, blah, blah.

Useful clc-related links:

http://en.wikipedia.org/wiki/Aspergers
http://en.wikipedia.org/wiki/Clique
http://en.wikipedia.org/wiki/C_programming_language


在文章< er ********** @ murdoch.hpl.hp.com>,

Chris Dollin< ch ********** @ hp .comwrote:
In article <er**********@murdoch.hpl.hp.com>,
Chris Dollin <ch**********@hp.comwrote:

>任何人都可以通过cprogram告诉我如何获取我的机器的IP地址
没有使用套接字编程。是否有任何
系统调用来获取我的机器的IP地址,将用于在c程序中显示我的机器的IP地址。
>Anybody can give me idea how to get the ip address of my machine
through a cprogram with out using the socket programming. Is there any
system call to get the ip address of my machine that will be used in
the c program to display the IP address of my machine.


>标准C中没有这样的功能。
>There''s no such function in standard C.



由于计算机可以轻松拥有多个IP地址(或者没有),

你可能想要考虑你想要什么。


- 理查德

-

在一些字母表中需要考虑多达32个字符

" - 1963年的X3.4。

And since a computer can easily have several IP addresses (or none),
you might want to consider what exactly you want.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.


这篇关于如何通过'C'程序获取我的机器的IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆