[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] c++ og strings



sslug@sslug wrote:

>> On Monday 07 July 2003 22:32, you wrote:
> 
>> Det er fordi du prøver at addere to udtryk med typerne const char[15] og
>> const
>> char[12], ( for "Build date is " + __DATE__;) og der findes ingen +
>> operator
>> til addering af de to typer. Løsningen kan f.eks. være at skrive:
>>
>> output  = std::string("XML_template class v. ") + CurrentVersion + "\n";
>> output += std::string("Build date is ") + __DATE__;
> 
> Eller alternativt:
> 
> output += "Build date is " __DATE__;
> 
> Mvh. Mads Sejersen

Det virker også. Det fik mig til at tænke for min tidligere konklusion 
havde været at den ikke havde overloaded +-operatoren, men det må den jo 
have gjort hvis += skal virke.

Denne variant virker:

        string output;
        string CurrentVersion;

        output  = "XML_template v. ";
        output += CurrentVersion;
        output += "\n";
        output += "Built date "  __DATE__  "\n";

problemet lod til at være at 'CurrentVersion' var en string, hvor den anså 
konstanterne for at være 'char *' - og eftersom vi havde to forskellige 
type data, virkede overloaderen ikke.

Tak for hjælpen.

PS.
mine problemer med qt, var en historie om at den ikke kunne klare at man 
havde sat 'strict' flaget. Lidt bekymrende, men gemt til en anden god gang 
:-)


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *