Board index » delphi » StrToChar
Guillermo Sanchez
![]() Delphi Developer |
Sat, 11 Dec 2004 23:13:43 GMT
|
Guillermo Sanchez
![]() Delphi Developer |
Sat, 11 Dec 2004 23:13:43 GMT
StrToChar
Hi there!
I want to store a string in a file as char? Pe.: The user typed the string 2000 in a Tedit object. How should I define this field in the file? How can I assign this string to this char field without having 'incompatible |
Andreas Koc
![]() Delphi Developer |
Sun, 12 Dec 2004 01:25:42 GMT
Re:StrToCharQuoteGuillermo Sanchez wrote: You want to store "2000" as one letter? -- |
Humberto Jemm
![]() Delphi Developer |
Sun, 12 Dec 2004 01:25:21 GMT
Re:StrToCharHi, Quote>I want to store a string in a file as char? Quote>Pe.: The user typed the string 2000 in a Tedit object. Quote>How should I define this field in the file? anyway. Quote>How can I assign this string to this char field without terminated) string, if that's what you want. Search Delphi's help for 'String handling routines' and 'String handling routines (null terminated)'. You can also use typecasting. But if you use a text field, you'll not need that. Humberto Jemma (Brazil) ------------------------------- |
Guillermo Sanche
![]() Delphi Developer |
Sun, 12 Dec 2004 02:29:13 GMT
Re:StrToCharSorry not being more specific. I meant an Array of char. I'm going to check 'String handling routines' as Humberto told me... I'll let you all know, thanks a lot. Quote"Andreas Koch" <m...@kochandreas.com> wrote in message Quote
|
Team
![]() Delphi Developer |
Sun, 12 Dec 2004 03:17:14 GMT
Re:StrToCharQuoteIn article <3d18889b$1_2@dnews>, Guillermo Sanchez wrote: string of length > 1 into it, at least if you want to be able to restore the string again <g>. Quote> The user typed the string 2000 in a Tedit object. Rewrite, WriteLn in the online help)? A file of some record type (in which case the record fields need to be declared as String[someLength], where someLength <= 255)? A database file? -- |
Guillermo Sanche
![]() Delphi Developer |
Sun, 12 Dec 2004 03:20:49 GMT
Re:StrToCharI meant an array of char, sorry by that. Can I? "Peter Below (TeamB)" <100113.1...@compuXXserve.com> wrote in message news:VA.00008d91.0091a0ad@antispam.compuserve.com... Quote> In article <3d18889b$1_2@dnews>, Guillermo Sanchez wrote: |
Guillermo Sanche
![]() Delphi Developer |
Sun, 12 Dec 2004 03:42:55 GMT
Re:StrToCharPeter: Here is the whole thing..... WHAT IS IT ALL ABOUT? WHAT DO I NEED? WHAT HAVE I DONE? THERE ARE 3 ISSUES I CURRENTLY HAVE: SOME CODE...: for i := 1 to 4 do for i := 1 to 2 do layout.charfieldC := bytefield; BUT, I'm getting 'imcompatible type' error. Can you help me out with this? Quote"Guillermo Sanchez" <guillermo_sanc...@codetel.com.do> wrote in message Quote> I meant an array of char, sorry by that. |
Andreas Koc
![]() Delphi Developer |
Sun, 12 Dec 2004 05:06:30 GMT
Re:StrToCharQuoteGuillermo Sanchez wrote: of length 1, not a char. To get a char, use s[i]: var for i := 1 to 2 do -- |
John Herbste
![]() Delphi Developer |
Sun, 12 Dec 2004 06:18:33 GMT
Re:StrToChar"Guillermo Sanchez" <guillermo_sanc...@codetel.com.do> wrote Quote> I want to store a string in a file as char? and CloseFile procedures? --Regards, JohnH |
Team
![]() Delphi Developer |
Mon, 13 Dec 2004 05:19:13 GMT
Re:StrToCharQuoteIn article <3d18c798$1_2@dnews>, Guillermo Sanchez wrote: still did not show one important pieve of info: a part of your record declaration that show how you have actually declared the "array of char" fields. It matters whether you declared them with a 0 or a 1 as lower bound. If you used a lower bound of 0 you can copy string data to the field by using StrPLCopy or StrLCopy. If you used 1 (which I actually prefer in records since 1-based char arrays are traditionally fixed-length strings in Pascal) you have to use something like this: Procedure AssignFixedString( Var FixedStr: Array of Char; Const S: String ); AssignFixedString( The procedure will also work with 0-based arrays of char, by the way. The main -- |
John Herbste
![]() Delphi Developer |
Mon, 13 Dec 2004 05:36:35 GMT
Re:StrToCharPeter, That you are a paragon of patience does not go unappreciated! Best regards, JohnH |
Guillermo Sanche
![]() Delphi Developer |
Fri, 17 Dec 2004 23:27:44 GMT
Re:StrToCharJhon/Peter: Sorry if I make some of you unconfortable in any way. Andreas, thanks, I follow your hint, and it worked fine. Thanks to all of you anyway. I appreciate very much you help. Quote"John Herbster" <Jo...@petronworld.com> wrote in message Quote> Peter, That you are a paragon of patience does |
1. StrtoChar?