Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #70793

Re: Question on a C++ string

From T <T@invalid.invalid>
Newsgroups comp.lang.c++
Subject Re: Question on a C++ string
Date 2019-12-29 15:02 -0800
Organization A noiseless patient Spider
Message-ID <qubba5$702$3@dont-email.me> (permalink)
References <qu9hgc$nut$1@dont-email.me> <slrnr0gsmi.5eh.grahn+nntp@frailea.sa.invalid> <qu9sst$6j4$2@dont-email.me> <87y2uupzg6.fsf@nosuchdomain.example.com>

Show all headers | View raw


On 2019-12-29 13:57, Keith Thompson wrote:
> T <T@invalid.invalid> writes:
>> On 2019-12-29 01:33, Jorgen Grahn wrote:
>>> You have "C++ string" in the subject line, but this question seems to
>>> be as offtopic as the other recent ones from you.  I don't see how to
>>> help you with this problem, from a comp.lang.c++ point of view.
>>
>> What I need to know is the construction of a C++ string
> 
> What exactly do you mean by a "C++ string"?  Are you asking about the
> std::string class defined in the <string> header?
> 
> If so, what about the construction of a std::string object are you
> asking about?  Most of the internal details are unspecified.
> 
> C++ also has C-style strings, referred to in the standard as
> "null-terminated byte strings" (and often referred to as "C-strings"
> or something similar).
> 

Hi Keith,

I figured it out.

Native call is converting to C anyway.  This is from my
Navice Call notes:

3) a “C” string is an array of characters terminated with chr(0)

4) Kernel32.dll calls with a “W” in them use UTF16 `uint16` values
    in their strings.  The rest you can use UTF8 `uint8`.  Most of
    the time they are interchangeable if you are using standard
    characters.

    Use the following to convert a Raku strings, `abcdefg` below,
    into a “C” string

       UTF8:  my $L =  CArray[uint8].new("abcdefg".encode.list);
       UTF16: my $M = CArray[uint16].new("abcdefg".encode.list);

    Native Call is tack the chr(0) at the end for you.



Thank you again for all the wonderful teaching!

-T

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Question on a C++ string T <T@invalid.invalid> - 2019-12-28 22:35 -0800
  Re: Question on a C++ string Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-29 09:33 +0000
    Re: Question on a C++ string Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 01:45 -0800
      Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 01:49 -0800
        Re: Question on a C++ string Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-29 11:04 +0000
        Re: Question on a C++ string Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 13:57 -0800
          Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 14:57 -0800
    Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 01:50 -0800
      Re: Question on a C++ string Jorgen Grahn <grahn+nntp@snipabacken.se> - 2019-12-29 11:08 +0000
        Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 11:50 -0800
          Re: Question on a C++ string Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 13:57 -0800
            Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 15:00 -0800
      Re: Question on a C++ string Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2019-12-29 13:57 -0800
        Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 15:02 -0800
          Re: Question on a C++ string Paavo Helde <myfirstname@osa.pri.ee> - 2019-12-30 01:28 +0200
      Re: Question on a C++ string Sam <sam@email-scan.com> - 2019-12-29 21:47 -0500
  Re: Question on a C++ string Bo Persson <bo@bo-persson.se> - 2019-12-29 11:00 +0100
    Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 02:33 -0800
      Re: Question on a C++ string Bart <bc@freeuk.com> - 2019-12-29 12:09 +0000
        Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 11:51 -0800
  Re: Question on a C++ string Paavo Helde <myfirstname@osa.pri.ee> - 2019-12-29 12:17 +0200
    Re: Question on a C++ string Barry Schwarz <schwarzb@delq.com> - 2019-12-29 08:45 -0800
      Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 11:54 -0800
  Re: Question on a C++ string Öö Tiib <ootiib@hot.ee> - 2019-12-29 02:56 -0800
    Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 12:02 -0800
  Re: Question on a C++ string Barry Schwarz <schwarzb@delq.com> - 2019-12-29 08:39 -0800
    Re: Question on a C++ string T <T@invalid.invalid> - 2019-12-29 12:10 -0800

csiph-web