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 6678127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:12:21+00:00 2026-05-26T04:12:21+00:00

I need to make a program that generates a password that is saved in

  • 0

I need to make a program that generates a password that is saved in a text file format in a specific destination I set and the user needs to open the .txt to get the password to ‘unlock’ another program.

I have already got the code to generate the password in the string sPass and now I need to use the SaveToFile function to save it into the text file I created called Password.txt but I cannot find the general form to use the SaveTo File Function in Delphi and I do not know where to put the sPass and Password.txt in the function.

It should be something like : SaveToFile(…) but I do not know how to save sPass in Password.txt

Edit :

Just one more question, how do you delete what is previously stored in Password.txt before you add the string to it so that Password.txt is blank before the string is added ? Thanks

  • 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-26T04:12:21+00:00Added an answer on May 26, 2026 at 4:12 am

    The modern way is to create a stringlist and save that to file.

    procedure MakeAStringlistAndSaveThat;
    var
      MyText: TStringlist;
    begin
      MyText:= TStringlist.create;
      try
        MyText.Add('line 1');
        MyText.Add('line 2');
        MyText.SaveToFile('c:\folder\filename.txt');
      finally
        MyText.Free
      end; {try}
    end;
    

    Note that Delphi already has a related class that does everything you want: TInifile.
    It stores values and keys in a key = 'value' format.

    passwordlist:= TInifile.Create;
    try
      passwordlist.LoadFromFile('c:\folder\passwords.txt');
      //Add or replace a password for `user1`
      passwordlist.WriteString('sectionname','user1','topsecretpassword');
      passwordlist.SaveToFile('c:\folder\passwords.txt');
    finally
      passwordlist.Free;
    end; {try}
    

    Warning
    Note that saving unecrypted passwords in a textfile is a security-leak. It’s better to hash your passwords using a hashfunction, see: Password encryption in Delphi
    For tips on how to save passwords in a secure way.

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

Sidebar

Related Questions

I have a program that generates a plain text file. The structure (layout) is
I need to be able to make a program that looks through a mailbox
I need to make sure that user can run only one instance of my
I need to generate a program that generates the Fibonacci Sequence Here is what
I'm trying to make a setup program for an ASP.NET web site. I need
I have a crystal report file I need make a tiny edit in. It
I have to make a schema for an XML format that's already being used.
I am writing a program that generates standard alias names per table name. In
For a program i'm writing I need to marshal ActionScript classes to a format
I am looking for a program that can make class diagrams for C#. I

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.