Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

How to Edit 'hosts' File in Windows - Why to Edit It?

default contents of hosts file shown in screenshot of hosts file
Windows host file screenshot
There is a file named 'hosts' located in the following path: C:\Windows\System32\drivers\etc. For me, C is the Windows installation drive. Replace it with your Windows installation drive. The file can be found in the same path in Windows 7, Windows 8 and Windows 10. This file is used to map host names to IP addresses.

Why use hosts file

As said earlier, the hosts file is used to map domain name (actually host names) to IP some address. The file contains many lines starting with # symbol. Those lines are comments. Within the comments you can see some examples showing how to use the hosts file. Each line (not comments) should contain an IP address followed by a space and a host name. The format is:

IP_address<space>Host_name

When you access the host with given host name using your browser or any other application, before looking for the host name in your Internet Domain Name Service (DNS), your computer looks in the hosts file first. If there is an entry for the hostname the IP address provided in its line is used to access the website.

In the example given by Microsoft, rhino.acme.com is redirected to 102.54.95.97. Similarly x.acme.com is redirected to some other IP.

Why 127.0.0.1 ?

127.0.0.1 is the loop back address. It is the IP of your own computer. It is corresponding IP for localhost. localhost is the host name used to represent the computer from which we are accessing network (means our own computer). It is same to use 127.0.0.1 or localhost. But you cannot redirect a host name to another host name in hosts file. You should use an IP. When you redirect some host name to 127.0.0.1, actually you are redirecting the access to your own computer, which means blocking access to that host name

Uses of hosts file

As we have seen, the uses of hosts file are:
  • Redirecting one host (or website) to another using an IP
  • Blocking websites completely (by redirecting to 127.0.0.1)
Some people use hosts file to prevent pirate software accessing the vendors website to avoid auto update. We won't recommend piracy. Find a free software alternative if you cannot afford buying it.

C Program to Remove (Delete) a Directory using LINUX System Calls

This is a C program to delete  or remove a directory using the system calls in Linux or Unix operating systems. The program make use of the remove() system call in Linux.

#include<stdio.h>
#include<fcntl.h>
main()
{

C Program to open, read and write files and perform file copy operation usingSystem Calls in UNIX

Write a program to open, read and write files and perform file copy operation. This program show how to open, read, write and copy files using Linux or Unix system calls like open(), read() and write().

#include<stdio.h>
#include<fcntl.h>
main()
{

How to Launch an html file (web page) using Autorun

Here in this post we will see how to launch a .html  file automatically from a CD or DVD using Windows AutoRun feature. If you are new to Autorun, please read this post: What is AutoRun and AutoPlay ? How to Set it ?

If you want to know more about autorun commands, please read this post: How to Make a AutoRun CD or DVD Using Autorun.inf

The open command used in tte autorun.inf file cannot launch an html file (web page ) directly. Instead, we can open the webpage through some application.

How to Launch .msi Files using Autorun from CD

In this post, we will see how to autorun a .msi file from a CD. If you are new to Autorun, please read this post: What is AutoRun and AutoPlay ? How to Set it ?
If you want to know more about autorun commands, please read this post: How to Make a AutoRun CD or DVD Using Autorun.inf

The open command supports only executable files. So, if you want to launch an msi (miscrosoft installer) file from CD automatically when it is inserted to CD drive, use the following code in the Autorun.inf file.

How to Make a AutoRun CD or DVD Using Autorun.inf

In this post we will see how to setup autorun on a CD or Pen drive using Autorun.inf file. If you are planning to create a CD with autorun (launch a file automatically on insertion of disc), this post will be helpful for you. If you are not much familiar with AutoRun, read the following post, to get an idea about autorun feature:  What is AutoRun or AutoPlay and How to Set it?

Now, we see how to make an autorun CD.