Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 204887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:30:27+00:00 2026-05-11T17:30:27+00:00

What is the simplest way of maintaining a txt based database file that allows

  • 0

What is the simplest way of maintaining a txt based database file that allows the program the write in new or edit existing entry during execution time.

to be specific, the program must be capable of storing a client, ip and port when it logs in, and remove accordingly when the client logs out, without using “internal” approaches like linkedlists.

EDIT: thanks first to the suggestions, however there is a restriction in the file that i forgot to mention, the file must be in .txt format.

the exact format is

User Name IP Address Port Number

Alice 122.33.44.23 1045

Bob 121.23.12.34 1078

which different field must be separated by a

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:30:27+00:00Added an answer on May 11, 2026 at 5:30 pm

    Installing a database as several other posters have suggested will buy you certain things such as transaction security and the possibility of expanding what you store (at the moment, you need just IP/port, but maybe later you’ll store more things, and maybe more permanently?)

    However, if your requirements are going to remain as simple as you state, then I’m going to controversially suggest that using a SQL database isn’t the simplest solution (even though, as I say, for certain requirements, a database does buy you certain things).

    A very simple solution would be simply to have some directory in which, every time a client logs in, you create a file whose name encodes the information you want (or a hash of identifying information, and store extra info in the file). Then, when the client logs off, you delete the file. Issues you’ll need to be careful of include what happens when your app exits abnormally, splitting among several directories if you have more than, say, a couple of thousand clients (Windows in particular seems to go ape if you have too many files in a directory, even though principle you should be able to store as many as you like), and managing filing system “issues” (the virus checker is accessing a file just as you need to delete…).

    This simple solution isn’t actually as bad as it sounds: the filing system is actually designed to access and index things efficiently, just like a database.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What's the simplest/canonical way to create an empty file in C#/.NET? The simplest way
What is the simplest way to call a program from with a piece of
What is the simplest way to remove the header row from a flat file
What is the simplest way to write a timer in C/C++? Hi, What is
What is the simplest way to read and write game configurations like: whether to
What is the simplest way to use database persistence in Java? I know, many
What is the simplest way to add UIToolBar to UITableViewController? I'm depending on edit
What's the simplest way to connect and query a database for a set of
What's the simplest way of blocking a thread until a file has been unlocked
What's the simplest way to jump to a file somewhere in my source tree

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.