Difference between fprintf, printf and sprintf?

Printf    –   writes output to the standard output stream(stdout).

int printf(const char* str, …);

// Example program to demonstrate printf()
int main()
printf(“hello Innovation Begins Here\n”);
return 0;

O/P: hello Innovation Begins Here
Man page: printf(3): formatted output conversion

Sprintf   –   writes output to a buffer that you allocate(char*).

int sprintf(char *str, const char *string,…);
String print function it is stead of printing on console store it on char buffer which are specified in sprint.

// Example program to demonstrate sprintf()
int main()
char buffer[10];
int a = 1, b = 2, c;
c = a + b;
sprintf(buffer, “Sum of %d and %d is %d”, a, b, c);
// The string “sum of 1 and 2 is 3” is stored
// into buffer instead of printing on stdout
printf(“%s”, buffer);
return 0;
O/P: Sum of 10 and 20 is 30
Man page: sprintf(3): formatted output conversion

Fprintf  –  writes output to a file handle (FILE *).

int fprintf(FILE *fptr, const char *str, …);

int main()
int i, n=1;
char str[50];
//open file sample.txt in write mode
FILE *fptr = fopen(“sample.txt”, “w”);
if (fptr == NULL)
printf(“Could not open file”);
return 0;
for (i=0; i<n; i++)
puts(“Enter a name”);
fprintf(fptr,”%d.%s\n”, i, str);
return 0;

O/P: Input  from your keyboard Innovation Begins Here
Output: sample.txt file now having output as
Innovation Begins Here
Man page: fprintf(3): formatted output conversion

Follow Innovation Begins Here on Twitter,Facebook , Google+ &Linkdin.



What are the valid signatures for C’s main() function – int main() or void main() ?

Neither main() or void main() are standard C. The former is allowed as it has an implicit intreturn value, making it the same as int main(). The purpose of main’s return value is to return an exit status to the operating system.

The current C standard C11 valid signatures for main are:

int main(void)

int main(int argc, char **argv)

The form you’re using: int main() is an old style declaration that indicates main takes an unspecified number of arguments. Don’t use it – choose one of those above.

Exit Status:

The exit status or return code of a process in computer programming is a small number passed from a child process (or callee) to a parent process (or caller) when it has finished executing a specific procedure or delegated task. In DOS, this may be referred to as an errorlevel.

The C programming language allows programs exiting or returning from the main function to signal success or failure by returning an integer, or returning the macros EXIT_SUCCESS and EXIT_FAILURE. On Unix-like systems these are equal to 0 and 1 respectively.

Follow Innovation Begins Here on Twitter,Facebook , Google+ &Linkdin.

Beginner’s Guide to understand SSH and Setting up SSH On Ubuntu

This article covers the SSH client on the Linux Operating System.

Note: This article is one of the top tutorials covering SSH on the Internet. It was originally written back in 1999.

There are a couple of ways that you can access a shell (command line) remotely on most Linux/Unix systems. One of the older ways is to use the telnet program, which is available on most network capable operating systems. Accessing a shell account through the telnet method though poses a danger in that everything that you send or receive over that telnet session is visible in plain text on your local network, and the local network of the machine you are connecting to. So anyone who can “sniff” the connection in-between can see your username, password, email that you read, and commands that you run. For these reasons you need a more sophisticated program than telnet to connect to a remote host.

SSH, which is an acronym for Secure SHell, was designed and created to provide the best security when accessing another computer remotely. Not only does it encrypt the session, it also provides better authentication facilities, as well as features like secure file transfer, X session forwarding, port forwarding and more so that you can increase the security of other protocols. It can use different forms of encryption ranging anywhere from 512 bit on up to as high as 32768 bits and includes ciphers like AES (Advanced Encryption Scheme), Triple DES, Blowfish, CAST128 or Arcfour. Of course, the higher the bits, the longer it will take to generate and use keys as well as the longer it will take to pass data over the connection.

Slide1                                      Slide1

These two diagrams on the left show how a telnet session can be viewed by anyone on the network by using a sniffing program like Ethereal (now called Wireshark) or tcpdump. It is really rather trivial to do this and so anyone on the network can steal your passwords and other information. The first diagram shows user jegadezz logging in to a remote server through a telnet connection. He types his username jegadezz, which are viewable by anyone who is using the same networks that he is using.

The second diagram shows how the data in an encrypted connection like SSH is encrypted on the network and so cannot be read by anyone who doesn’t have the session-negotiated keys, which is just a fancy way of saying the data is scrambled. The server still can read the information, but only after negotiating the encrypted session with the client. 

Client-Side Installation 

To install SSH client on Ubuntu by by executing the following command: 

sudo apt-get install openssh-client

Getting SSH installed is really easy, and only takes a few other bits of information to get going. On the computer which you’d like to use to connect to other computers, you’ll need to install the OpenSSH client if it isn’t already. On Ubuntu systems this can be done with sudo apt-get install openssh-client. Once that installation completes, you’re already good to go with one computer. 

To install SSH server on Ubuntu by by executing the following command: 

sudo apt-get install openssh-server

On every computer that you want to connect to, you’ll need to install the server-side part of the software if it isn’t already. You can do so on Ubuntu systems with the command sudo apt-get install openssh-server. Once this is installed, all of the needed software is installed. 

Follow Innovation Begins Here on Twitter,Facebook , Google+ &Linkdin.

Ncurses – Software emulator

Lnux on the desktop is making great progress. However, the real beauty of Linux and Unix like operating system lies beneath the surface at the command prompt. ncurses picks his best open source terminal application.

ncurses (new curses) is a programming library that provides an API which allows the programmer to write text-based user interfaces in a terminal-independent manner. It is a tool kit for developing “GUI-like” application software that runs under a terminal emulator. It also optimizes screen changes, in order to reduce the latency experienced when using remote shells.


Great tools for terminal based on ncurses:


cmus is a music player that I admire the most when it comes to command-line because it’s really powerful and has a lot of nice features. It is built with ncurses and therefore providing a text-user interface. cmus is indeed feature-rich, with several view modes and Last.fm song submission support via scripts.



Finch comes bundled with Pidgin, the popular IM client. Finch offers the same functionality that Pidgin offers, only that it does it in a terminal by using the ncurses library. It supports IM protocols like Yahoo, Google Talk, XMPP (Facebook), WLM (Windows Live Messenger) .



htop is an interactive process viewer tool using ncurses which has the great benefit that it allows to scroll up and down the list of processes, and it also uses graphs and colors.


There are plenty of tools available based on ncurses like moc,aview,convert,lynx.

Follow Innovation Begins Here on Twitter,Facebook , Google+ & Linkdin.

what is the Raspberry pi?

Three years ago a small single board computer stamped with chips and I/O connectors, began receiving a great deal of press coverage. It has captured the curiosity of tech journalists and enthusiasts around the world due to a combination of its purpose, capabilities, and usefulness — with the tasty name of Raspberry Pi.

Raspberry Pi is essentially a bare-bones of personal computer with a Linux operating system. Raspberry Pi is a low cost, credit-card sized computer that plugs into a computer monitor or TV, and uses a standard keyboard and mouse. It is a capable little device that enables people of all ages to explore computing, and to learn how to program in languages like Scratch and Python. It’s capable of doing everything you’d expect a desktop computer to do, from browsing the internet and playing high-definition video, to making spreadsheets, word-processing, and playing games.

What’s more, the Raspberry Pi has the ability to interact with the outside world, and has been used in a wide array of digital maker projects, from music machines and parent detectors to weather stations and tweeting birdhouses with infra-red cameras. They want to see the Raspberry Pi being used by kids all over the world to learn to program and understand how computers work.

There are several reasons why the Raspberry Pi is a big deal. For the technology community, this illustrates that the super cheap and ultra-affordable PC is indeed a reality. For those wanting to learn more about technology and developing it, doing so is now more affordable and accessible than ever. At the cost of a textbook, nearly everyone should be able to get a Raspberry Pi if they have the desire to learn and to potentially pursue new opportunities.

Fighter Jets May Launch Small Satellites to Space

by Elizabeth Howell | February 27, 2015

Small satellites could hitch rides to space on an F-15 fighter jet by next year, according to the Defense Advanced Research Projects Agency (DARPA), the agency responsible for developing new technologies for the U.S. military.

DARPA’s so-called Airborne Launch Assist Space Access (ALASA) program is an ambitious project that aims to launch small satellites more quickly, and reduce the cost of lofting them into orbit. Traditional launches using rockets cost roughly $30,000 per pound ($66,000 per kilogram), DARPA officials have said.

The F-15 jet would take off on a nearly vertical trajectory, with the expendable launch vehicle mounted underneath it. Essentially, the fighter jet acts as the first stage of a rocket, according to DARPA. After the aircraft flies to a high altitude, it releases the satellite and can then return to land on a conventional runway.

What Happens When Drones Start Thinking on Their Own?

By Andy Miah, University of Salford   |   February 27, 2015

This article was originally published on The Conversation. The publication contributed this article to Live Science’s Expert Voices: Op-Ed & Insights.

You will be forgiven if you missed the Drones for Good competition held recently in Dubai. Despite drone technology really taking off commercially in the last year or so (the potential puns are endless) they remain a relatively niche interest.

Drones – or unmanned aerial vehicles (UAVs) as they are increasingly known – have reached a mass-market tipping point. You can buy them on the high street for the price of a smartphone and, despite a large DIY Drone community, the out-of-the-box versions are pretty extraordinary, fitted with built-in cameras and “follow me” technology, where your drone will follow you as you walk, run, surf, or hang-glide. Their usefulness to professional filmmakers has led to the first New York Drone Film Festival to be held in March 2015.

Technologically speaking, drones’ abilities have all manner of real-world applications. Some of the highlights from the US$1m prize for the Drones for Good competition include a drone that delivers a life-ring to those in distress in the water. Swiss company Flyability took the international prize for Gimball, a drone whose innovative design allows it to collide into objects without becoming destabilised or hard-to-control, making it useful in rescue missions in difficult areas.

The winner of the national prize was a drone that demonstrates the many emerging uses for drones in conservation. In this case, the Wadi drone can help record and document the diversity of flora and fauna, providing a rapid way to assess changes to the environment.

More civilian uses than military

What does this all mean for how we think about drones in society? It wasn’t long ago that the word “drones” was synonymous with death, destruction, and surveillance. Can we expect us all to have our own personal, wearable drone, as the mini-drone Nixie promises? Of course the technology continues to advance within a military context, where drones – not the kind you can pick up, but large, full-scale aircraft – are serious business. There’s even a space drone, NASA’s Boeing X-37, which spent several years in automated orbit, while others are in development to help explore other planets.

There’s no escaping the fact that drones, like a lot of technology now in the mainstream, have trickled down from their military origins. There are graffiti drones, drone bands, Star Wars-style drone racing competitions using virtual reality interfaces, and even theatrical drone choreography, or beautiful drone sculptures in the sky.

There are a few things about drones that are extremely exciting – and controversial. The autonomous capabilities of drones can be breathtaking – witnessing one just fly off at speed on its own, it feels extremely futuristic. But this is not strictly legal at present due to associated risks.

A pilot must always have “line of sight” of the drone and have the capacity to take control. Technically even the latest drones still require a flight path to be pre-programmed, so the drone isn’t really making autonomous decisions yet, although the new DJI Inspire is pretty close. Drone learning has to be the next step in their evolution.

Yet this prospect of artificial intelligence raises further concerns of control, if a drone could become intelligent enough to take off, fly and get up to all kinds of mischief, and locate a power source to re-charge, all without human intervention or oversight, then where does that leave humanity?

There are also concerns about personal privacy. If Google Glass raised privacy hackles, drones will cause far worse problems. There have already been a few occasions where drones have caused some trouble, such as the one that crashed onto the Whitehouse lawn, or the one that overshot into a runway at London Heathrow. The point at which a drone is involved in something very serious may be the point at which their status as a mainstream toy ends.

This article was originally published on The Conversation. Read the original article.

Follow Innovation Begins Here on Twitter, innovationBeginsHere,Facebook , Google+ & Linkdin.

Innovation distinguishes between a leader and a follower.If you want become a leader just follow us.