CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    How to get the size of a pointer for LPSTR?


    I would like to get the size of the whole data in lpSTR in the following
    after I insert some 'data' into data.

    int *data = new int[100];
    LPSTR lpStr;
    lpStr = (LPSTR) data; //I am trying to convert the 'int'data to 'LPSTR'data.
    // is this correct ?
    //insert data
    delete [] data;

    What is the command for obtaining the size of lpStr ?
    Please help me!
    I would like to appreciate your help in advance.



  2. #2
    Join Date
    Jun 1999
    Location
    Miami, FL
    Posts
    972

    Re: How to get the size of a pointer for LPSTR?

    The size of lpStr is based on the number of integers you put into data (0 to 100) multiplied by the size of an integer (4 bytes).

    Alvaro


  3. #3
    Join Date
    May 1999
    Location
    Wisconsin, USA
    Posts
    953

    Re: How to get the size of a pointer for LPSTR?


    #define MAXINT 100

    int *data = new int[MAXINT];
    LPSTR lpStr;
    lpStr = (LPSTR) data;

    int tmp = sizeof(data);
    int tmp2 = sizeof(lpStr);

    // both tmp and tmp2 will equal 4, the size of a pointer (not the size of data that is being pointed at).

    // so one way to figure the size out would be something like this:

    int tmp3 = sizeof(data) * MAXINT;

    delete [] data;




    I am curious as to what you are going to use the lpStr variable for.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured