PC Review


Reply
Thread Tools Rate Thread

Correct way to write etc/hosts

 
 
Haxan
Guest
Posts: n/a
 
      9th Feb 2007
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


 
Reply With Quote
 
 
 
 
Ignacio Machin \( .NET/ C# MVP \)
Guest
Posts: n/a
 
      9th Feb 2007
Hi

"Haxan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| 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


 
Reply With Quote
 
Nathan Mates
Guest
Posts: n/a
 
      9th Feb 2007
In article <(E-Mail Removed)>,
>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
 
Reply With Quote
 
Bruno van Dooren [MVP VC++]
Guest
Posts: n/a
 
      10th Feb 2007
>>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
(E-Mail Removed)
Remove only "_nos_pam"


 
Reply With Quote
 
Ben Voigt
Guest
Posts: n/a
 
      12th Feb 2007

"Haxan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Correct way to write VO2? Shane Exton Microsoft Access 2 28th Oct 2008 01:21 PM
Correct way to write etc/hosts Haxan Microsoft VC .NET 4 12th Feb 2007 04:30 PM
when i write some thing to correct and error it over writes. =?Utf-8?B?dXJiYW4gdGhyZWF0?= Microsoft Access 1 13th Nov 2006 03:23 AM
Is this the correct way to write code pspyve Microsoft Excel Programming 1 18th Jul 2006 10:28 AM
hosts file to block or correct ip address marks542004@yahoo.com Windows XP General 2 11th Jul 2006 10:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:30 PM.