Linux by Ripudaman Singh

Image
Customize the Bash [Linux] Your terminal window generally has username@hostname but you can change that we will discuss here how to change it.   link for details: Read-1 Read-2 Read-3 Let's make the Example setup as in above picture with live time cp ~/.bashrc ~/.bashrc.bak  In case of a problem it will help to get back the old file  nano ~/.bashrc Add the follwing line at the Last PS1="\e[0;35m\w\e[m\n\@ \e[0;35m$\e[m " close the nano by ctrl X, Y enter. making Changes active by source ~/.bashrc To customize in your own way see the above links. Get the localhost at some other name [Linux] Open your terminal and type  sudo nano /etc/hosts map your name with localhost address like 127.0.0.1       localhost 127.0.1.1       ripudaman # The following lines are desirable for IPv6 capable hosts ::1 ctrl X, y enter All done you can access the localhost at your describe name for me its ripudaman (helpful when making twitt...

How to print a system date in C language

C language:

Today I' m going to tell you how to print the sys date in C language
codes:(With respect to turbo C++ )


// For turboC Only

#include <dos.h>   // since we want the date from your system software
#include <stdio.h> // since we have used printf

void main() // only main execute

{

    struct date d; // here i declared a variable "d "which is structed with the date which is already defined in c library

    getdate(&d); // here i got the date of system in my variable d

    printf("\n %d/%d/%d", d.da_day, d.da_mon, , d.da_year);

    // in above line we printed the system date

    // da_day : have the system day ; calling is "d.da_day" ; as your variable is d

    // da_mon : have the system month ; calling is "d.da_mon" ; as your variable is d

    // da_year : have the system year ; calling is "d.da_year" ; as your variable is d

    getch(); // to make the output screen to stay
}


Comments

Post a Comment

Popular posts from this blog

GIT tool for GITHUB/

Linux by Ripudaman Singh

CS IT PDFS