Board index » delphi » A question about typecasting
wakkowar...@my-dejanews.com
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
|
wakkowar...@my-dejanews.com
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
A question about typecastingIs it possible to typecast a string into and array of char? Or is there any Thanks, - Matas -----------== Posted via Deja News, The Discussion Network ==---------- |
Frank Peel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:A question about typecastingQuotewakkowar...@my-dejanews.com wrote in message Quote>Is it possible to typecast a string into and array of char? Or is Assuming you're not using recent Delphi versions, where strings are If you are certain that it will never be longer than 254 chars s := s+#0; where s is the string and p is a pChar. It's important for p to skip FP |
Horst Kraem
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:A question about typecastingQuoteOn Thu, 08 Oct 1998 06:10:35 GMT, wakkowar...@my-dejanews.com wrote: TP denoted by the syntax some_type(something) is by definition A) a conversion of a _value_ of one ordinal (enumerable) data type pointer(byte_var) boolean(nil) longint('a') byte($FFFF) or, B) a temporary reinterpretion of the bit pattern of a _variable_ of If both interpretations could apply the result is identical and TP Clearly nothing of this is what you want. Quote> Or is there any application and the reason why you want it. You may treat a string variable as if it was an array[1..length(s)] of If this is not enough to solve your specific problem, my question arr:array[x..y] of char ? If you "just want it because you think you need it" and you don't like move(s[1],arr,sizeof(s)); If you use 'move' there is no possible check by the system if the Regards |
wakkowar..
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:A question about typecastingIn article <361c7a75.37327...@news.snafu.de>, Quote> On Thu, 08 Oct 1998 06:10:35 GMT, wakkowar...@my-dejanews.com wrote: Quote> There are several answers. Which you prefer depends on your Quote> If this is not enough to solve your specific problem, my question I have been asked to do a low-level (DOS Int 21h Services) managing of a file. What I'm doing is using a kind of "large string" (of about 4kb) represented by Since my read/write functions use this "large string" as a buffer, I'm trying Now suppose the data entered is a string (as it is). Since a string is If there is any other "obvious" solution that I'm missing, I'd be grateful if Quote> If you "just want it because you think you need it" and you don't like Besides, in this particular case I know how many bytes are going to go either one way or another, so there should be no fear of writing "past" the end of either variable. Thanks, - Matas -----------== Posted via Deja News, The Discussion Network ==---------- |
Frank Peel
![]() Delphi Developer |
Wed, 18 Jun 1902 08:00:00 GMT
Re:A question about typecastingQuotewakkowar...@my-dejanews.com wrote in message Quote>... buffer then strlcat(p, @s[1], length(s)); would append s to the null-terminated string p, assuming that you know FP |