-2

I like understand a execute file is 64 bit or no. I want to understand a run process in Linux is 64 bit or 32 bit with c++. I do not want to use "file" command. for example: File -L bash

3 Answers3

5

You need to parse the elf header. You can write your own parser, or use a dedicated library such as this one: http://elfio.sourceforge.net/

stdcall
  • 27,613
  • 18
  • 81
  • 125
2

you should use elfio lib. this is a link for that: (http://elfio.sourceforge.net)

hamed
  • 113
  • 6
  • Rather than checking the binary, you can at compile time determine the result by using preprocessor macros expanded by the compiler. See the linked questions marked as duplicate. – David Rodríguez - dribeas Sep 16 '13 at 13:25
0

you can use: readelf -h <executable file name>

SamB
  • 9,039
  • 5
  • 49
  • 56
shulianghe
  • 94
  • 1
  • 3