LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   read /proc/net/dev with sscanf? (https://www.linuxquestions.org/questions/linux-general-1/read-proc-net-dev-with-sscanf-307784/)

Thinking 03-30-2005 09:14 AM

read /proc/net/dev with sscanf?
 
hiho@ll

i try to read the /proc/net/dev network device file with fgets and the use sscanf to save the elements to some variables

i tried sscanf(buff," %s:%ld %d %d ...",&interfacename,&receivedbytes,&receivedpackets,...);

the problem is that after receivedbytes every variable is 0
i think it's because of the spaces are depending on the size of the value i want to read
sometimes 2 spaces, sometimes 1 space sometimes more

anyone knows a workaround, or maybe i have false sscanf syntax, to (ignore) read more space characters?

thx@ll


All times are GMT -5. The time now is 05:06 PM.