Click here to Skip to main content
15,884,472 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
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.
Posted
Updated 13-Aug-14 2:21am
v2

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.
 
Share this answer
 
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
 
Share this answer
 
Comments
Nelek 13-Aug-14 9:44am    
OP wrote you in a non-solution:
@ 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....
Andreas Gieriet 13-Aug-14 16:14pm    
Thanks for highlighting.
I still am confused by the question. I mean OP could have come to that answer himself easily. I.e. if someone wants to start such a task, I assume a minimal understanding of what abstraction layer an OS provides. It simply does not fit.
I sometimges think we answer too quickly and people forget to think before posting a question...
Cheers
Andi
Nelek 14-Aug-14 4:09am    
You might be assuming a bit too much. There are a lot of users asking questions that could be answered with tons of results found by a mini search.
Andreas Gieriet 15-Aug-14 2:33am    
What I wonder is the discrepancy between the targeted solution and the lack of basic knowhow. There is often a huge gap/lack of a sense for reality. I wonder if such posters would ask in their full name such questions...
Cheers
Andi
PS: Don't get me wrong: I very much welcome almost any question as long it is not pure laziness to think a tiny little bit himself and it is not completely off reality.
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....
 
Share this answer
 
Comments
Nelek 13-Aug-14 9:43am    
Please don't post solutions to chat with people asking or answering. The messages are not always sorted by date, so it can be a bit difficult to follow them correctly.
The best option is to use the "Have a question or comment?" (or the tiny "reply" on another comment). Another advantage is, that the person you write to will get a notification, otherwise it could be that he/she doesn't see your additional message.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900