473,327 Members | 1,967 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,327 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 1735
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: shawnk | last post by:
I want to use the Hosts file to locate schema for validation. The Hosts file (C:\Windows\System32\etc) will locate xsd schema files on a LAN server for development purposes. This gives me a...
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.