delphi - XE6 - How to convert TStringStream content to TStream? -


i using following code convert tstringstream tstream. give error when try copy tstringstream's content tstream.

it seems making obvious mistake not able catch it.

my code:

procedure tfrmmain2.button1click(sender: tobject); var   ss:tstringstream;   s, s2:tstream;   photostr: string; begin   photostr := 'hello world, testing: /9j/4aaqskzjrgabaqaaaqabaad//' +      'ga7q1jfqvrpujogz2qtanblzyb2ms4wich1c2luzybjskcgslbfryb2njip' +      'lcbxdwfsaxr5id0goduk/9saqwafawqebamfbaqebqufbgcmcachbwcpcwsj' +      'dbepehirdxerexycfxmughurerghgbodhr8fhxmxiiqihiqchh8e';    ss := tstringstream.create(photostr);   s := tstream.create();   s.copyfrom(ss, ss.size);  //<= line gives error end; 

the error message getting is: ...class ewriteerror message 'stream write error'.

i don't know why getting error.

you creating instance of tstream abstract class. must never instantiate tstream directly. instantiate descendent class instead, such tfilestream, tmemorystream, etc.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -