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

  • Home
  • SEARCH
  • 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 6185569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T01:44:17+00:00 2026-05-24T01:44:17+00:00

in Delphi the procedure write can handle: write(TF,st1) and write(TF,st1,st2,st3,st4); I want to declare

  • 0

in Delphi the procedure write can handle:

write(TF,st1)

and

write(TF,st1,st2,st3,st4);

I want to declare a procedure that can also do that, what is the syntax?

and the option of:

write(TF,[st1,st2,st3])

is less desirable, though I know how to do that.

the main purpose was to pass ShortStrings into function, that would make a read call from file, and would read at the length of the shortString as defined. however after passing it as variant or in open array the shortString loses its “size” and become 255, which making this pass unusable, for me.
but the answer is still got if you want to pass open array.

  • 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-24T01:44:18+00:00Added an answer on May 24, 2026 at 1:44 am

    First of all Inc and Write are bad examples because they both get special treatment from the compiler. You can’t write a function that behaves exactly like those two do yourself. There are alternatives you should investigate.

    Take a look at overloads

    You can create multiple versions of your method using varying number of parameters, and varying types. Something like this:

    procedure MyInc(var i:Integer); overload;
    procedyre MyInc(var i:Integer; const N:Integer); overload;
    procedure MyInc(var i:Integer; const N1, N2: Integer); overload;
    procedure MyInc(var i:Integer; const N1, N2, N3: Integer):overload;
    

    This is feasible if the required number of overloads is not that large. The compiler would probably handle lots of overloads easily, but you’d probably not want to write them. When the number of overloads becomes a problem you can switch to arrays:

    Using Open Arrays as parameters

    A function can take a parameter of type array of YourType, and when you call that function you can pass as many parameters as you might need:

    procedure MyInc(var i:Integer; Vals: array of Integer);
    

    And then use it like this:

    MyInc(i, []); // no parameters
    MyInc(i, [1]);
    MyInc(i, [1, 34, 43, 12]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let me explain by an example. In Delphi, you can write procedure TForm1.FormKeyPress(Sender: TObject;
Using Delphi 2007 I can write the following code: interface TTestType = (ttTest1, ttTest2);
I want to know whether we can do such in Delphi: I have a
I used the following code in delphi for handle : procedure TForm1.ADOQuery1FetchProgress(DataSet: TCustomADODataSet; Progress,
I'm trying to write a class in Delphi 2007 that uses a ActiveX library.
In delphi, how do you write a MemoryStream to a data resource? procedure StringtoRes
In Delphi, the declaration of the DivMod function is procedure DivMod(Dividend: Cardinal; Divisor: Word;
Delphi 2010 introduced custom attributes which can be added to type declarations and methods.
i studying TDateTime functions and procedure, but not found something that allow me to
I'm using the TWebModule component to write a web server application with Delphi. Clicking

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.