Activate/deactivate Wi-Fi on Lenovo B5400 under Ubuntu 14.04
Solution 1
A dirty trick worked: I booted the machine in Windows and started the wifi from Fn+F5 combination; note that this works in windows only when HotKey Intergration Driver is installed from lenovo site.
The main question is: what if one gets the laptop w/o Windows, e.g. free dos or linux pre-installed?
Solution 2
You can turn off your wifi using iwconfig
.
To do that open a terminal and type the following command:
iwconfig wlan0 down
That should turn off your wifi. To turn it on you can use:
iwconfig wlan0 up
You can also turn it on/off using the wireless settings menu. Go to system setings → network → wireless. There you can turn it on/off.
Related videos on Youtube
Lorenzo Imperatrice
Updated on September 18, 2022Comments
-
Lorenzo Imperatrice over 1 year
I'm new to C and I would like to know if it's possible to write into a string the character
\n
from the keyboard by usingscanf()
function.The code that I'm using is this: (sorry for the Italian variables words)
void riempi_array_stringhe (char* stringhe[], int lunghezza_array) { for (int i = 0; i < lunghezza_array; i++) { stringhe[i] = (char*) malloc(sizeof(char) * 100); printf("Insert a new string: "); scanf("%s", stringhe[i]); } }
I tried type shift + enter, alt + enter, or to insert \n as input but not works at all.
Thanks in advance!
-
tom about 6 yearsDoubt it can be done, just use getchar() or getch()
-
sinkmanu about 6 yearsA little trick is save the string in a file and input it. e.g. python -c 'print "A\nB\nhi"' > foo and ./your program < foo
-
Paul R about 6 years...or even
fgets
-
cup about 6 yearsscanf is an input function: not an output function. You can't write with an input function.
-
Rishal about 6 yearsjust press enter
-
Lorenzo Imperatrice about 6 yearsThis question has a curiosity purpose, so yes, I can even do it like you guys said (that is actually the best way because scanf is dangerous to use), but i was interested in doing this with scanf function.
-
Lorenzo Imperatrice about 6 years@cup didn't exactly understand what you mean with this
-
Lorenzo Imperatrice about 6 years@Rishaldevsingh if I just press enter I just say to the program that I finished to input the string.
-
Rishal about 6 yearswhat happens when you put '\n' as input in console, is there any error or any kind of output you are able to see
-
Lorenzo Imperatrice about 6 years@Rishaldevsingh it just write \n in the string
-
tadman about 6 yearsWhy do people insist on using
scanf
for everything under the sun? It's not always the best tool, and in fact is often the worst possible tool due to how it can and will wildly overfill buffers. -
Lorenzo Imperatrice about 6 years@tadman As I said in a comment before, This question has a curiosity purpose. You're right! scanf is the worst.
-
-
Lucian Sasu almost 10 yearsThanks for your answer. When I press on the on/off button you highlighted in the last picture, the button remains on the off position. Any clue?
-
M.Tarun almost 10 yearsplease post the output of
rfkill list all
-
Lucian Sasu almost 10 yearsAdded as later edit for the question.
-
Lorenzo Imperatrice about 6 yearsSo the best way is to terminate the string input in a different way, and there is no char (or combination of chars) that can be inserted from keyboard that represent \n in an input right??
-
Andriy Berestovskyy about 6 years@LorenzoImperatrice user can input
\n
and we can manually substitute it to newline in our code, i.e.:scanf(..., str[i]); str_replace(str[i], "\\n", "\n");
Please note there is nostrreplace()
in C, so you should google for an example implementation... -
Lorenzo Imperatrice about 6 yearsThank you very much for the detailed explanation!
-
Jonathan Leffler about 6 yearsNote that the
%[^EOF]
scan set looks for any character except capital-E, capital-O, capital-F — it has nothing to do withEOF
except the coincidence that the list of letters is the same. Also note that%[^EOF]
will read newlines into the string; indeed, it will keep reading until it crashes, or encounters one of the letters, E, F, O, or it runs into EOF. It won't stop merely because you reach the end of a line.