473,385 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Correct way to write etc/hosts

Hi,
I am looking for a way to write etc/hosts file.
Is there any APIS for search/delete/insert/update for entries ? or behave
hosts as a normal file ?

thanks in advance
Feb 9 '07 #1
4 4441
Hi

"Haxan" <ab***@gmail.comwrote in message
news:Op**************@TK2MSFTNGP06.phx.gbl...
| Hi,
| I am looking for a way to write etc/hosts file.
| Is there any APIS for search/delete/insert/update for entries ? or behave
| hosts as a normal file ?

Not that I know of, why do u want to do this anyway?
--
Ignacio Machin
machin AT laceupsolutions com
Feb 9 '07 #2
In article <Op**************@TK2MSFTNGP06.phx.gbl>,
>I am looking for a way to write etc/hosts file.
It's a text file. Pretty much every language under the sun has
capabilities to read/write a text file a line at a time. Not rocket
science, but might be a little tedious.

Nathan Mates
--
<*Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Feb 9 '07 #3
>>I am looking for a way to write etc/hosts file.
>
It's a text file. Pretty much every language under the sun has
capabilities to read/write a text file a line at a time. Not rocket
science, but might be a little tedious.
..NET has easy to use APIs like the TextWriter class.
Just be sure that you have the appropriate permissions.
I think you have to run with admin privileges.

--

Kind regards,
Bruno van Dooren
br**********************@hotmail.com
Remove only "_nos_pam"
Feb 10 '07 #4

"Haxan" <ab***@gmail.comwrote in message
news:Op**************@TK2MSFTNGP06.phx.gbl...
Hi,
I am looking for a way to write etc/hosts file.
Is there any APIS for search/delete/insert/update for entries ? or behave
hosts as a normal file ?
system32/drivers/etc/hosts is a normal text file, the only additional thing
you need to worry about is that the DNS client service might cache the
contents. "ipconfig /flushdns" is the command to expire the cache
immediately, I don't know the equivalent API.
>
thanks in advance

Feb 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Option^Explicit | last post by:
What I'm trying to do: Open a text file and display the contents in a text box (I've done this) Need to be able to edit the file from within the textbox and have it save back to the source...
0
by: Liza | last post by:
Hi, I run Tomcat5.0.24 on Fedora Core 1. I have two hosts defined in server.xml in a following way: <Host name ="WebTest1.something.com" debug="0" appBase="webapps" unpackWARs="true"...
0
by: Bla | last post by:
Hello, Does anyone have a script that would remove the appropriate line from the hosts file on a UNIX box. This might be a tricky one? Let's say we have a list of hosts and associated ip's we...
0
by: David Swanson | last post by:
I am trying to configure the proxy section of the machine.config to handle BOTH connecting to hosts that are not "live" but rather defined in my winnt/system32/drivers/etc/hosts file. AND to hosts...
2
by: felecha | last post by:
I'm working on a system that has a several computers that run an alerting system. There are 2 "Host" machines that have no user interface, and one "Admin" station that has an Administrator's...
7
by: Bob | last post by:
I'm using PHP 5.1.1 with Apache 2.0.54 and several virtual hosts. PHP is installed as a module. I've created a very simple test page containing <?php phpinfo(); ?> and placed it at the doc root...
4
by: Haxan | last post by:
Hi, I am looking for a way to write etc/hosts file. Is there any APIS for search/delete/insert/update for entries ? or behave hosts as a normal file ? thanks in advance
4
by: DanWeaver | last post by:
I am dumbfounded at the apparent lack of an obvious mechanism that prevents finding a shared host being the absolute nightmare it is: due to the nature of the business (ie techies who know about...
5
by: mike.coakley | last post by:
Does stream_socket_client use the /etc/hosts file? I'm using Mac OSX 10.5.3 as a development platform and VMware Fusion for VM hosting. I have a OpenSUSE Linux VM that has an Apache 2 web server...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.