Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-07-2008, 12:58 PM   #1
Registered: Oct 2008
Location: earth
Distribution: Ubuntu 'Gutsy Gibbon'
Posts: 32

Rep: Reputation: 15
how to get the wifi signal strength by using linux command in c language?

i want to get the wireless signal strength value to do my project.
and i found that linux command iwconfig can show the value.
in c language, i use the system() call, but it returns only value 0 or 1 to indicate whether the command is successfully executed or not.
the command i use is,

int i = system(iwconfig $_[0]|grep Signal|cut -d"=" -f3|cut -d" " -f1);

although it will print out the value, but the value of i=0 which indicates the command is successfully being executed.

Now the problem is i can't manipulate the value it print out.

so does anyone can help me to figure out how to get the value?

thanks a lot.
Old 10-07-2008, 02:02 PM   #2
LQ Guru
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 126Reputation: 126
Use popen... it's like fopen, but instead of reading a file, it lets you read from (or write to) a process.
Old 10-08-2008, 12:17 AM   #3
Registered: Oct 2008
Location: earth
Distribution: Ubuntu 'Gutsy Gibbon'
Posts: 32

Original Poster
Rep: Reputation: 15
Thanks!! It helps!!

Thanks a lot. I now successfully manipulate the value.
after using the popen, i use fgets() to get the string and then use atoi() to convert it to integer.
really thanks a lot.


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 Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting AP signal strength via C program ... toships Linux - Wireless Networking 5 01-07-2009 03:35 AM
Strength of Wireless Network Signal nlavon Linux - Wireless Networking 4 06-06-2008 08:19 AM
Wireless signal strength indicator Volhv Ubuntu 7 08-07-2007 09:59 PM
Signal Strength Meter shows low signal? falcon56215 Linux - Networking 0 09-15-2006 08:39 AM
Signal strength not showing hosler Linux - Software 3 03-31-2006 09:17 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:04 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration