K
K
kpa6uu2015-11-15 14:42:15
Programming
kpa6uu, 2015-11-15 14:42:15

How to get value from c++ builder thread?

Good day to all.
The question is, how to get the fs value from the stream?
The following code saves the resulting value, "1", to the "in.txt" file.

TStringList *s = new TStringList;
TMemoryStream *fs = new TMemoryStream();
s->Clear();
s->Add("sLine=123");
IdHTTP1->Request->Connection = "keep-alive";
IdHTTP1->Request->ContentType = "application/x-www-form-urlencoded";
IdHTTP1->Request->ContentLength = 9;
IdHTTP1->HandleRedirects=true;
IdHTTP1->Post( "http://www.example.com/index.php",s,fs);
fs->SaveToFile("in.txt");

However, when you try to "tear out" the value, nothing comes out. Returns null.
Tried like this:
char buf;
ShowMessage(fs->Read(&buf, 1));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2015-11-15
@kpa6uu

Before reading, return the pointer to the beginning of the stream
fs->Seek(0, soFromBeginning);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question