LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-07-2008, 11:58 AM   #1
christyyim
Member
 
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, 01:02 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 124Reputation: 124
Use popen... it's like fopen, but instead of reading a file, it lets you read from (or write to) a process.
 
Old 10-07-2008, 11:17 PM   #3
christyyim
Member
 
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.
 
  


Reply


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 02:35 AM
Strength of Wireless Network Signal nlavon Linux - Wireless Networking 4 06-06-2008 07:19 AM
Wireless signal strength indicator Volhv Ubuntu 7 08-07-2007 08:59 PM
Signal Strength Meter shows low signal? falcon56215 Linux - Networking 0 09-15-2006 07:39 AM
Signal strength not showing hosler Linux - Software 3 03-31-2006 08:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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