CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Aug 2001
    Posts
    28

    i need an idea how to..

    i have TXT file that contains all the IP's of the users that r on my FTP..(at real time)..so i want to do a program that will delete all the same IP's..
    for example my list is:

    212.123.321.123
    212.234.123.121
    212.123.321.123

    so i want it to be:
    212.234.123.121



  2. #2
    Join Date
    Aug 2000
    Location
    Ottawa, Canada
    Posts
    469

    Re: i need an idea how to..

    Delete from where? From the file? It's impossible. What you can do is to create another new file without those IP's OR rewrite your existing file completely.

    So. Create an array and read your IP's line by line and enter them into the array. But before entering each one you should check if such IP already exists in your array. If so - just erase that element of the array.
    At the end write all not empty elements of your array to the file.

    PS. You can use a chain instead of an array - whatever you like better.


  3. #3
    Join Date
    Aug 2001
    Posts
    28

    Re: i need an idea how to..

    can u give me an expmle...of how to do all this?


  4. #4
    Join Date
    Aug 2000
    Location
    Ottawa, Canada
    Posts
    469

    Re: i need an idea how to..

    Yes, I can. But I won't!

    Firstly, I have to write and test that example before I can give it to you.

    Secondly, you can do it by yourself, because it's very easy to do even for a beginner. So, it means you're lazy and that is not my problem.

    And finally, I haven't seen you ever rate anybody from those who gave you helpful answers to your previous questions.

    So, as you can see I have no single reason to waste my time with an example for you.
    That's it, buddy.


  5. #5
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: i need an idea how to..

    Way to go man. Exellent answer!

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

  6. #6
    Join Date
    Jun 2001
    Location
    Memphis, TN
    Posts
    146

    Re: i need an idea how to..

    Hi there,
    Just out of curiousity... in that post you mentioned using a chain or an array depending on preference. I just haven't heard the term chain used before and I was wondering if you mean something like a Linked List or Collection. Thanks!

    Jeff


  7. #7
    Join Date
    Aug 2000
    Location
    Ottawa, Canada
    Posts
    469

    Re: i need an idea how to..

    Yeah, sorry. That is definitely linked list what I meant.
    Artefacts from my background. :-)


  8. #8
    Join Date
    Jun 2001
    Location
    Memphis, TN
    Posts
    146

    Re: i need an idea how to..

    Haha, thanks!


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured