适用于所有类型的操作系统 [英] common to all types of OS

查看:80
本文介绍了适用于所有类型的操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我想编写C ++代码来获取所有类型操作系统通用的MAC ID和主板ID。

示例我编写的代码应该适用于Windows操作系统以及CentOS / Ubuntu



可以帮助我编写公共代码。

我想知道是否可以吗?



提前致谢,请帮助我...



谢谢和问候,

Chakri V.

解决方案

事实上,你不能。

即使MAC地址和主板ID都是不同操作系统的常见信息,您收集它们的方式取决于操作系统本身,并且完全不同。


OS是用户域和HW之间的层。列出的操作系统之间没有通用的方法从用户端访问硬件。某些操作系统甚至可能无法提供开箱即用的访问权限。



我想知道你为什么要求使用通用代码?这是一个面试问题,看你是否对操作系统提供的抽象有一个非常基本的了解?



问候

Andi

感谢你们两位回复.....



@Andi ...

这个不是面试问题......我正在编写代码来开发使用硬件ID的PC的唯一代码。我只是想知道是否可以使用通用代码...



再次感谢....


Hello,

I want to write C++ code to get MAC id and mother board ID which is common to all types of OS.
Example the code I have written should work on windows OS as well as CentOS/Ubuntu

Can any please help me to write the common code.
I want to know if it is possible or not?

Thanks in advance and please help me...

Thanks & Regards,
Chakri V.

解决方案

In fact, you cannot.
Even if both MAC address and mother board id are common pieces of info for the different operative systems, the way you may collect them depends on the operative systems themselves and are quite different.


The OS is a layer between the user-land and the HW. There is no common way between the listed OS to access HW from user-land. Some OS might not even provide the acces you need out-of-the-box.

I wonder why you ask for common code? Is this an interview question to see if you have a very basic understanding of what abstraction an OS provide?

Regards
Andi


thanks to both of you for replies.....

@ Andi...
this is not interview question... I am writing code to develop unique code for PC's using hardware id's. I just want to know is it possible to have common code or not...

Once again thanks....


这篇关于适用于所有类型的操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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