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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:07:38+00:00 2026-05-21T17:07:38+00:00

Question One I have var example : array[0..15] of char; I want to assign

  • 0

Question One

I have

var example : array[0..15] of char;

I want to assign the value from an input to that variable

example := inputbox('Enter Name', 'Name', '');

In the highscores unit I have record and array

type
points = record
var
  _MemoryName : array[0..15] of char;
  _MemoryScore : integer;
end;

var
rank : array[1..3] of points;

var s: string;
 a: packed array[0..15] of char;

highscoresdata.position[1]._MemoryName := StrPLCopy(a, s, Length(a)) ;

returns -> (186): E2010 Incompatible types: 'array[0..15] of Char' and 'PWideChar'

var s: string;
 a: packed array[0..15] of char;

             s := InputBox('caption', 'Caption', 'Caption');
             FillChar(a[0], length(a) * sizeof(char), #0);
             Move(s[1], a[0], length(a) * sizeof(char));
      scores.rank[1]._MemoryName := <<tried both s and a>> ;

returns (189): E2008 Incompatible types

  • 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-21T17:07:39+00:00Added an answer on May 21, 2026 at 5:07 pm

    Question One

    There are many ways. One is:

    procedure TForm1.FormCreate(Sender: TObject);
    var
      s: string;
      a: packed array[0..15] of char;
    begin
      s := InputBox(Caption, Caption, Caption);
      assert(length(s) <= 16);
      FillChar(a[0], length(a) * sizeof(char), #0);
      Move(s[1], a[0], length(s) * sizeof(char));
    end;
    

    But there might be a more elegant solution to your original problem, I suspect.

    Question Two

    Every time you wish a function/procedure didn’t have a particular argument, you should realize that there might be a problem with the design of the project. Nevertheless, it isn’t uncommon that Sender parameters are superfluous, because they are almost omnipresent because of the design of the VCL (in particular, the TNotifyEvent). If you know that the receiving procedure doesn’t care about the Sender parameter, simply give it anything, like Self or nil.

    Question Three

    Consider this code:

    procedure TForm4.FormCreate(Sender: TObject);
    var
      a: packed array[0..15] of char;
      b: packed array[0..15] of char;
    begin
      a := b;
    end;
    

    This doesn’t work. You cannot treat arrays like strings; in particular, you cannot assign static arrays like this (a := b).

    Instead, you have to do something like…

    Move(b[0], a[0], length(a) * sizeof(char));
    

    …or simply loop and copy one value at a time. But the above simple assignment (a := b) does work if you declare a static array type:

    type
      TChrArr = packed array[0..15] of char;
    
    procedure TForm4.FormCreate(Sender: TObject);
    var
      a: TChrArr;
      b: TChrArr;
    begin
      b := a;
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I have one more question lol. I am using a script that
I have a simple question related to one-line programming. First an example: function test(a)
I have two files, one containing an array in PHP that is echo ed
I have one question regarding domain account. I have one domain controller where all
I have one question; In my ASP.NET MVC web application have to do certain
Hopefully a simple question although one I have found impossible to answer myself using
I am learning JPA and have one question: In which situations we need more
I consume Java Service in my .NET appliaction. I have one question: When service
Question ONE: I'm still pretty new to .net, but have used Visual Studio for
I have two String.printable mysteries in the one question. First, in Python 2.6: >>>

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.