Re: stl string and win32 API

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Igor Tandetnik (itandetnik_at_mvps.org)
Date: 10/19/04

  • Next message: Carl Daniel [VC++ MVP]: "Re: adding items to a map"
    Date: Tue, 19 Oct 2004 10:27:59 -0400
    
    

    "Cheng" <chengwuchew@yahoo.com> wrote in message
    news:uFFcufYtEHA.1548@TK2MSFTNGP10.phx.gbl
    > If a vector were to be used as a temporary variable, then using plain
    > char * as tempoprary variable is the same too. Any comment is
    > welcomed.

    The difference between using a vector and manually allocating a char*
    array, is that vector will automatically free its memory when it goes
    out of scope, whereas you have to remember to free the array. One less
    chance of introducing a memory leak.

    -- 
    With best wishes,
        Igor Tandetnik
    "On two occasions, I have been asked [by members of Parliament], 'Pray, 
    Mr. Babbage, if you put into the machine wrong figures, will the right 
    answers come out?' I am not able to rightly apprehend the kind of 
    confusion of ideas that could provoke such a question." -- Charles 
    Babbage 
    

  • Next message: Carl Daniel [VC++ MVP]: "Re: adding items to a map"

    Relevant Pages

    • Re: Passing Pointers
      ... 'char const ' as argument type. ... '*iptr' does not refer to the 100 character array you've just ... Draw one hundred small boxes representing the array. ... So here you have the memory leak mentioned earlier on. ...
      (comp.lang.cpp)
    • Re: Passing Pointers
      ... 'char const ' as argument type. ... '*iptr' does not refer to the 100 character array you've just ... Draw one hundred small boxes representing the array. ... So here you have the memory leak mentioned earlier on. ...
      (alt.comp.lang.learn.c-cpp)
    • Re: Window Management
      ... (* prompt is a string resource identifier specifying the string ... PROCEDURE YesNoCancel(prompt: ARRAY OF CHAR; ... VAR INOUT response: ARRAY OF CHAR): BOOLEAN; ...
      (comp.lang.ada)
    • Window Management
      ... (* prompt is a string resource identifier specifying the string ... PROCEDURE YesNoCancel(prompt: ARRAY OF CHAR; ... VAR INOUT response: ARRAY OF CHAR): BOOLEAN; ...
      (comp.lang.ada)
    • Re: Pointer
      ... require in input a pointer char: ... unsafe public static extern int OpenFile; ... What is it pointing to exactly, is it pointing to a "Unicode character" array or is it pointing to a "Single byte character" array or is it pointing to something else? ...
      (microsoft.public.dotnet.languages.csharp)