Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 03-30-2005, 09:14 AM   #1
Registered: Oct 2003
Posts: 249

Rep: Reputation: 30
read /proc/net/dev with sscanf?


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?



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
/proc/sys/net/ipv4/ip_local_port_range wetwet Linux - Networking 0 07-06-2004 08:47 AM
Question about /proc/net/devc alitrix Linux - Networking 0 02-23-2004 12:29 PM
/proc/net/wireless MarkusMan Linux - Wireless Networking 2 01-26-2004 09:56 PM
/dev and /proc Stephanie General 1 09-05-2002 08:44 AM
symbolic link: /dev/sound to /proc/asound/dev otterit Linux - General 3 08-08-2002 05:33 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:14 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration