私はUnixの現在のログインユーザーとシステム名を印刷する方法を学ぶのを楽しみにしています。Unixで現在のユーザとシステム名を印刷するには?
#include <unistd.h>
#include <fcntl.h>
using namespace std;
int main(int argc, char **argv)
{
//Print the current logged-in user/username.
//Print the name of the system/computer name.
return 0;
}
デモンストレーションとしてコード行を提供できる場合は、私は感謝します。ありがとう
これは自宅の仕事の質問ですか?このようなことを真剣に尋ねるのではなく、むしろ研究をするべきでしょう。たとえば、http://en.wikipedia.org/wiki/Exec_(operating_system)を参照してください。 –
大丈夫..ありがとう。 [その間、宿題ではない]。 – CompilingCyborg