Bogdan Marinca wrote:
> 
> // [...]
>         string absPath ("./teste/htmls/test1.html");
>         fprintf (stderr, "`%s'\n", absPath.data ());
>         cerr << "CERR == `" << absPath << "'" << endl;
> // [...]
> 
> Rezultatul la strerr este:
> 
> `./teste/htmls/test1.html`@`@'
> CERR == `./teste/htmls/test1.html'
> 
> Care ar fi cauza ptr care `const char* string::data ()' returneaza asta?
> 
> Daca initializez stringul cu "./teste/htmls/test1", obtin la strerr
> 
> `./teste/htmls/test1'
> CERR == `./teste/htmls/test1'
> 
> S-a mai lovit cineva de comportamenul asta?
>                                                 Mersi.
>                                                         bogdan m.

Curios... ce versiune de compilator si de STL folosesti ?

Incearca sa inversezi ordinea liniilor sprintf(...) si cerr << ... ,
poate e un rahat de la optimizare. Eu presupun ca este aminata setarea
lui '\0' la sfirsitul sirului.

Si, chestie de stil, foloseste c_str() nu data(). Altfel, ar trebui sa
fie la fel :

public:                         // Conversion to C string.
  const _CharT* c_str() const { return _M_start; }
  const _CharT* data()  const { return _M_start; }

-- 
 Paul Chitescu
 [EMAIL PROTECTED]   [EMAIL PROTECTED]
 http://pchitescu.myip.org/     http://PaulC.MetroNet.RO.EU.org/
 ICQ:22641673

---
Send e-mail to '[EMAIL PROTECTED]' with 'unsubscribe rlug' to 
unsubscribe from this list.

Raspunde prin e-mail lui