X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: Help with GRX GrLineOption Date: 5 Apr 2004 10:11:09 GMT Organization: Aachen University of Technology (RWTH) Lines: 37 Message-ID: References: NNTP-Posting-Host: ac3b07.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 1081159869 17883 137.226.33.205 (5 Apr 2004 10:11:09 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 5 Apr 2004 10:11:09 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Chris wrote: > What is the proper way to use the GrLineOption? In case of doubt: the one shown in the GRX docs. > Snippet of GrTest.cc > GrLineOption opt = {GrWHite(), 1, 2, "\x06\x04"}; This should work: unsigned char pattern[] = { 6, 4}; GrLineOption opt = {GRWhite(), 1, 2, pattern}; Note that I replaced the string literal with an aggregate initializer. Initializing what is going to be treated as an array of numbers by a string using '\x..' notation all the way through is misleading. > "Invalid conversion from 'const char*' to 'unsigned char *'." The basic problem is that the struct field is a pointer to char, but a string literal is effectively 'const'. A C compiler usually wouldn't have bothered about this as long as the code using this struct doesn't actually modify the data stored in the pattern array, but you're compiling this as C++, which has considerably stricter rules about implicit pointer casts, so you get an error. C++ may even offer some way of avoiding the explicit named variable "pattern" by creating an anonymous object on the spot --- Java does. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.