delphi-unicode

Delphi XE - should I use String or AnsiString?

試著忘記壹切 提交于 2019-12-05 14:58:03
问题 I finally upgraded to Delphi XE. I have a library of units where I use strings to store plain ANSI characters (chars between A and U). I am 101% sure that I will never ever use UNICODE characters in those places. I want to convert all other libraries to Unicode, but for this specific library I think it will be better to stick with ANSI. The advantage is the memory requirement as in some cases I load very large TXT files (containing ONLY Ansi characters). The disadvantage might be that I have

Delphi XE - RawByteString vs AnsiString

ぃ、小莉子 提交于 2019-12-04 13:04:23
问题 I had a similar question to this here: Delphi XE - should I use String or AnsiString? . After deciding that it is right to use ANSI strings in a (large) library of mine, I have realized that I can actually use RawByteString instead of ANSI. Because I mix UNICODE strings with ANSI strings, my code now has quite few places where it does conversions between them. However, it looks like if I use RawByteString I get rid of those conversions. Please let me know your opinion about it. Thanks. Update

Delphi XE - should I use String or AnsiString?

[亡魂溺海] 提交于 2019-12-04 01:04:29
I finally upgraded to Delphi XE. I have a library of units where I use strings to store plain ANSI characters (chars between A and U). I am 101% sure that I will never ever use UNICODE characters in those places. I want to convert all other libraries to Unicode, but for this specific library I think it will be better to stick with ANSI. The advantage is the memory requirement as in some cases I load very large TXT files (containing ONLY Ansi characters). The disadvantage might be that I have to do lots and lots of typecasts when I make those libraries to interact with normal (unicode)

Delphi XE - RawByteString vs AnsiString

走远了吗. 提交于 2019-12-03 08:14:57
I had a similar question to this here: Delphi XE - should I use String or AnsiString? . After deciding that it is right to use ANSI strings in a (large) library of mine, I have realized that I can actually use RawByteString instead of ANSI. Because I mix UNICODE strings with ANSI strings, my code now has quite few places where it does conversions between them. However, it looks like if I use RawByteString I get rid of those conversions. Please let me know your opinion about it. Thanks. Update: This seems to be disappointing. It looks like the compiler still makes a conversion from

block read error

爷,独闯天下 提交于 2019-11-29 18:02:26
Can anybody please explain me why I am hitting 'I/O error 998' in the below block read? function ReadBiggerFile: string; var biggerfile: file of char; BufArray: array [1 .. 4096] of char; // we will read 4 KB at a time nrcit, i: integer; sir, path: string; begin path := ExtractFilePath(application.exename); assignfile(biggerfile, path + 'asd.txt'); reset(biggerfile); repeat blockread(biggerfile, BufArray, SizeOf(BufArray), nrcit); for i := 1 to nrcit do begin sir := sir + BufArray[i]; Form4.Memo1.Lines.Add(sir); end; until (nrcit = 0); closefile(biggerfile); ReadBiggerFile := sir; end; I think

block read error

喜夏-厌秋 提交于 2019-11-28 13:47:14
问题 Can anybody please explain me why I am hitting 'I/O error 998' in the below block read? function ReadBiggerFile: string; var biggerfile: file of char; BufArray: array [1 .. 4096] of char; // we will read 4 KB at a time nrcit, i: integer; sir, path: string; begin path := ExtractFilePath(application.exename); assignfile(biggerfile, path + 'asd.txt'); reset(biggerfile); repeat blockread(biggerfile, BufArray, SizeOf(BufArray), nrcit); for i := 1 to nrcit do begin sir := sir + BufArray[i]; Form4