[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: Re: Small programming question
From: Johannes Sixt <Johannes.Sixt () telecom ! at>
Date: 1998-01-09 21:25:46
[Download RAW message or body]
On Fri, 09 Jan 1998, Roberto Alsina wrote:
>What would be the simplest way to create a QString from a NOT-null
>terminated string?
>
> ("\''/").__..-''"`-. . Roberto Alsina
> `9_ 9 ) `-. ( ).`-._.`) ralsina@unl.edu.ar
> (_Y_.)' ._ ) `._`. " -.-' Centro de Telematica
> _..`-'_..-_/ /-'_.' Universidad Nacional del Litoral
>(l)-'' ((i).' ((!.' Santa Fe - Argentina
>"Bloody instructions which, being taught, return to plague their inventor"
If the string isn't null terminate, you must know its length. Hence:
void f(const char* buffer, int buflen)
{
QString s = QString(buffer, buflen+1);
// do with s what your heart desires here; it's a deep copy
}
-- Hannes
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic