Re: FC5 system() call

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>Morning all,
>
>Using FC3 life is good.  I compile up my code on FC5 with gcc-4.1.1 and
>all of a sudden the system() call is broken.
>
>The code:
>
>int num_proc = system("cat /proc/cpuinfo | grep -c processor >> /dev/null 2>&!");

Even assuming you mean 

int num_proc = system("cat /proc/cpuinfo | grep -c processor >> /dev/null 2>&1");

I dont see how this will give you the # of cpus.

num-proc will only contain the status of the system call, not the result
of the grep, wont it?

Terry.


>
>On every FC3 machine we've run on, this works fine and returns 1, 2 or
>4.
>
>Likewise on every FC5 machine we've ever run on, it returns -1, nothing
>else.  The man page for system() hasn't changed and I can't find any
>other information about it.
>
>Any ideas?
>
>:b!
>
>Brian D. McGrew { brian@xxxxxxxxxxxxx || brian@xxxxxxxxxxxxxxxxxxx }
>--
>> This is a test.  This is only a test!
>  Had this been an actual emergency, you would have been
>  told to cancel this test and seek professional assistance!
>
>
>-- 
>fedora-list mailing list
>fedora-list@xxxxxxxxxx
>To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux