Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Getting filesize the Expert Way

Name: Anonymous 2011-10-04 9:50

#include <stdio.h>

#define MAXNUMBER 1024

int main()
{
    int i;
    char a[MAXNUMBER];

    FILE *fp = popen("du -b  /bin/bash", "r");

    while((a[i++] = getc(fp))!= 9)
        ;

    a[i] ='\0';

    printf(" a is %s\n", a);

    pclose(fp);
    return 0;
}

Name: Anonymous 2011-10-04 9:57

Is executing an other process "the expert way"?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List