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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T19:49:28+00:00 2026-05-22T19:49:28+00:00

Its easy to define a string at the size of 3 (in old delphi

  • 0

Its easy to define a string at the size of 3 (in old delphi code)

st:string[3];

now, we wish to move the code to ansi

st:ansiString[3];

won’t work!

and for adcanced oem type

st:oemString[3]; 

same problem, where

type
  OemString = Type AnsiString(CP_OEMCP);

how could be declared a fixed length ansi string and the new oem type?

update: i know it will create a fixed length string. it is part of the design of the software to protect against mistakes, and is essential for the program.

  • 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-22T19:49:28+00:00Added an answer on May 22, 2026 at 7:49 pm

    You don’t need to define the size of an AnsiString.

    The notation

    string[3] 
    

    is for short strings used by Pascal (and Delphi 1) and it is mostly kept for legacy purposes.

    Short strings can be 1 to 255 bytes long. The first (“hidden”) byte contains the length.

    AnsiString is a pointer to a character buffer (0 terminated). It has some internal magic like reference counting. And you can safely add characters to an existing string because the compiler will handle all the nasty details for you.

    UnicodeStrings are like AnsiStrings, but with unicode chars (2 bytes in this case). The default string now (Delphi 2009) maps to UnicodeString.

    the type AnsiString has a construct to add a codepage (used to define the characters above 127) hence the CP_OEMCP:

    OemString = Type AnsiString(CP_OEMCP);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there an easy way to write C code that can access its Git
In the following code sample I define an enum and specify its underlying type
I think its easy to create form via only html and do not use
Is there a easy way to query a table for its constraints(foreignkeys specificaly) like
I have added an easy compound control which loads its layout from a XML
I am getting stuck on heapSort. I have some code but I think its
I have code that has a lot of complicated #define error codes that are
How could I define a simple hierarchy in some easy to read format and
It's easy to get the bounding rectangle for all the visible windows on a
It's easy to find duplicates with one field: SELECT email, COUNT(email) FROM users GROUP

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.