Archive for November, 2008
- TECHPULP |
How to redirect standard output and standard error to same file
Sometimes while compiling C source code, the screen scrolls down if lot of warnings and errors are generated. This is uncomfortable as you can’t see all errors and warnings and you can’t attend to all warnings and warning at once... - TECHPULP |
How to redirect output of a command in Linux
Many a times your script outputs lot of messages which may not be of any interest to the actual user. Also sometimes these messages may cause user not to notice any important messages printed in between. In such cases, it... - TECHPULP |
How to access files of a .iso file in Linux
A file with .iso extension is typically a raw image that can be used to burn a CD or DVD. A file with .iso can be created using mkisofs command or by doing raw copy of a CD or DVD.... - TECHPULP |
Why macro can’t be used instead of typedef in C
The C preprocessor blindly expands the macro with whatever they are defined with. Let us examine the following example. #define CHARPTR char* CHARPTR p1,p2; The C preprocessor expands the above code to the following. char *p1,p2; But we would like... - TECHPULP |
Why my netstat command is slow in Linux
Basically default usage of netstat command makes netstat command to resolve all IP addresses to display symbolic host names. If your connection to DNS server is slow or not working, netstat command spends some time in waiting for response from... - TECHPULP |
Why my route command is slow in Linux
Basically default usage of route command makes route command to resolve all IP addresses to display symbolic host names. If your connection to DNS server is slow or not working, route command spends some time in waiting for response from... - TECHPULP |
How do I resolve compiler error with my multi-lined macro in C
Let us look at the following plain multi-lined and multi-statement macro. #define SAY_HELLO() \ printf("Hi, There!\n"); \ printf("Nice to meet you\n"); If you use the above macro as shown below, you will encounter compilation errors. if(manager) SAY_HELLO(); else printf("You are... - TECHPULP |
How to swap two integers without using third variable
The safest way to swap two variables without using third variable is to use XOR operation as shown below. This example C program swaps integer values of two variables i and j. [neo@techpulp ~]# cat iswap.c #include <stdio.h> int main(int... - TECHPULP |
How to reset root password of my Fedora Linux system using GRUB
There are multiple ways of recovering your Linux system if you have forgotten the password for root account. In this article I will discuss about how to do it using GRUB and single user mode. GRUB provides great flexibility to... - TECHPULP |
How to resolve “Access denied for user” error with MySQL database connection
Typically “Access denied for user” error occurs while connecting to MySQL Database because the privileges are not properly set at the server. Let us examine the following real-time scenario where a user from the host 192.168.1.1 is trying to connect...