Saturday, October 22, 2011

how to Execute external program from c/c++

Execute external program from c/c++ 

#include <stdio.h>
void main(void) {
    FILE *in;
    extern FILE *popen();
    char buff[512];
    if(!(in = popen("ls -sail", "r"))){
        exit(0);
    }
    while(fgets(buff, sizeof(buff), in)!=NULL){
        printf("%s", buff);
    }
    pclose(in);
}

Centos 7 reset root/ any user lost password / lockout due to cant remember password

1. Need to be in front of the terminal. (Physically if not vm). 2. Reboot the server 3. Press 'e' in the GRUB2 boot screen. 3. bunch...