title: Getting MAC address in c and writing it to a txt file
body: <p>Following is my code. In this program I use system function and passe a command line argument to get the mac address of the pc and then write it into the txt file. txt file is creating successfully. But When I try to open the txt file which was created it wont show anything. It show letter M and some blank spaces. Any idea why is this happening ? Thank you.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  
   int main()
   {
  
    system("wmic nic where (AdapterTypeId=0 AND netConnectionStatus=2) get MACAddress &gt;macaddress.txt");
    FILE * fpointer=fopen("macaddress.txt","r");
    char buffer[500];
    while(!feof(fpointer)){
      fgets(buffer,500,fpointer);
      puts(buffer);
    }
  
    fclose(fpointer);
   }
  </code></pre>