string to char array?

anonymous via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 3 03:58:40 PDT 2015


On Wednesday, 3 June 2015 at 10:21:20 UTC, Kyoji Klyden wrote:
> On Wednesday, 3 June 2015 at 08:11:16 UTC, Kagamin wrote:
>> On Tuesday, 2 June 2015 at 16:41:38 UTC, Kyoji Klyden wrote:
[...]
>> 	string source = readText("test.glvert");
>>
>> 	const char* sources = source.ptr;
[...]
>> 	glShaderSource(vertShader, 1, &sources, &len);
[...]
> Also the one part I don't understand is with &sources. So is 
> this passing sources as a reference, but sources itself is a 
> pointer to a pointer? I'm just a tad confused on how this part 
> works :S

`&sources` is a pointer to `sources`. `sources` itself is a 
pointer to a char (leaving const-ness aside). So `&sources` is a 
pointer to a pointer to a char.


More information about the Digitalmars-d-learn mailing list