Browsing all articles from December, 2011
Dec
30

How to read system command output from Console In C

Author saurabh    Category Uncategorized     Tags

i want to run a command in linux, and get the text returned of what it outputs…but i DO NOT want this text printed to screen.

So this way you can use to do this.

Here we use popen in read mode

The popen() function shall execute the command specified by the string command. It shall create a pipe between the calling program and the executed command, and shall return a pointer to a stream that can be used to either read from or write to the pipe.

Code : -

read more

Dec
30

Firefox Add-ons and Useful sites for creating Add-ons

First of all we understand what is the meaning of Firefox add-ons and use of them.

Firefox Add-ons is a very popular feature to the firefox browser. It allows a user to change the behavior of the browser, often in the form of extra toolbars, context menus, themes or UI to customize the browser.

Add-ons is an installable file having an .XPI (Cross-Platform Installer Module) extension. Many of us are aware and use many of the well know extensions. To name a few, we have Web Developer, Error Console, Firebug, Facebook Toolbar, Alexa Toolbar and many more.

 

Types of Add-ons:

  • Extensions
                       Extensions modify the way Firefox works.
  • Appearance(Theme)
                       Themes modify the Graphic User Interface – the appearance of the browser window.
  •  Plug-in
                       A plugin is used to incorporate third-party programs (media players, PDF readers, etc) into the program session.Plugins are the “links” to external programs that handle files that Firefox doesn’t, like audio and video such as Flash or Java, or document platforms such as PDF files.
Some of the plugins that we use or at least we know- Realplayer Plugin, QuickTime Plug-in 7.5.5

read more

Dec
25

Most common directory layout seen in all C/C++ based Project/Package/Library

Author JIGAR PATEL    Category c, c++, projects, projects, Tips, tips     Tags

I have been with lots of projects package or library written in C or C++ programming language has One common directory layout. So if you planning to design any new package /project/library in C or C++ programming language then this will really help you to design directory layout of your project.

read more

Dec
22

Create a plugin in wordpress

Creating a plugin in wordpress is just like doing your favorite work with lot of fun.

so lets start to create very simple plugin in wordpress.

steps to create the plugin,

1> create a plugin folder.

for ex, my_first_plugin

2> now create a php file in that folder.

for ex, my_first_plugin\first_plugin.php

read more

Dec
15

Online C programming test | C programming Interview Questions and Answers

While surfing net i got one site which has excellent for doing Online c programming test. All Question are also divided by section vise like pointers, structures,functions..

Link: IndiaBix

 

 

read more

Dec
14

Why fopen() doesn’t get fail by passing directory name in argument?

Author JIGAR PATEL    Category c, linux, Tips, tips     Tags

Once i have made one small application where i was passing full file name as command line argument in my application where i am going to fopen() that file BUT once i have just passed any directory name instad of file name still my fopen() does not get fails…!!

#include<stdio.h>
#include <errno.h>
 
int main()
{
errno = 0;
FILE *fb = fopen("/home/jeegar/","r");
if(fb==NULL)
    printf("its null");
else
    printf("working");
 
printf("Error %d \n", errno);
 
}

output is

 workingError 0

here fb is not going null and also not getting any error..

read more

Dec
14

Whats is difference between file descriptor and file pointer?

Author JIGAR PATEL    Category c, linux, Tips, tips     Tags

After having 1 year of experience in c programming when someone has asked this to me i was surprised that why i dont know this…!!

Well when i will going to interview someone in someday this would be my 1st question to him/her…!!!

File Descriptor :  

  “A file descriptor is a low-level integer “handle” used to identify an opened file (or socket, or whatever) at the kernel level, in Linux and other Unix-like systems.”

 int fd;
 fd = open(path, O_CREAT | O_RDONLY, 0644);
 close(fd);

This way you are using that is file-descriptor. In short,  file-descriptor is

  1. Low/Kernel level handler
  2. passe to read() and write() of UNIX System Calls
  3. Doesn’t include buffering and such features
  4. Less portable and lacks efficiency
  5. It’s some what OS specific so its not part of standard c programming language.
Follow us on Twitter! Follow us on Twitter!

Search in this website

our sponsors

latest comments

Find us on Facebook

Top Authors

35 posts
saurabh
22 posts
10 posts

Find us on stackoverflow

Polls

Tell us who you are

View Results

Loading ... Loading ...

My Bookmarks

Sponsers Link