Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CHttp

CHttp

Scheduled Pinned Locked Moved C / C++ / MFC
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Tcpip2005
    wrote on last edited by
    #1

    TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();

    T M G 3 Replies Last reply
    0
    • T Tcpip2005

      TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();

      T Offline
      T Offline
      Tcpip2005
      wrote on last edited by
      #2

      I used this read UNICODE data, but It seemed that there is always mem uninitialized. what's the matter?

      N 1 Reply Last reply
      0
      • T Tcpip2005

        I used this read UNICODE data, but It seemed that there is always mem uninitialized. what's the matter?

        N Offline
        N Offline
        Neagoe Gabriel
        wrote on last edited by
        #3

        I don`t understand what u really want but after declaring TCHAR... do a memset( &buffer, 0, sizeof(TCHAR)); NG

        T 1 Reply Last reply
        0
        • N Neagoe Gabriel

          I don`t understand what u really want but after declaring TCHAR... do a memset( &buffer, 0, sizeof(TCHAR)); NG

          T Offline
          T Offline
          Tcpip2005
          wrote on last edited by
          #4
          N 1 Reply Last reply
          0
          • T Tcpip2005

            TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();

            M Offline
            M Offline
            MailtoGops
            wrote on last edited by
            #5

            You should allocate one more byte for '\0' char. TCHAR* buffer = new TCHAR[1025]; " Action without vision is only passing time, Vision without action is merely day dreaming, But vision with action can change the world " - Words from Nelson Mandela Thanks & Regards, Gopalakrishnan

            1 Reply Last reply
            0
            • T Tcpip2005

              TCHAR* buffer = new TCHAR[1024]; UINT ret = pFile->Read(buffer, 1024); while ( ret != 0 ) { buffer[ret] = TEXT('\0'); strText = buffer; OutWebResource += strText; ret = pFile->Read(buffer, 1024); } pFile->Close();

              G Offline
              G Offline
              Gary R Wheeler
              wrote on last edited by
              #6

              If your pFile->Read call reads 1024 TCHAR's, then ret has the value 1024. The line buffer[ret] = TEXT('\0'); will then overrun the end of buffer.


              Software Zen: delete this;

              1 Reply Last reply
              0
              • T Tcpip2005
                N Offline
                N Offline
                Neagoe Gabriel
                wrote on last edited by
                #7

                you have define UNICODE in your project because TCHAR type will have a size of 2 bytes then.... an CFile will work different or u can send by mail(to me) your file to see where.... NG -- modified at 10:27 Monday 5th September, 2005

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups