O
O
onlinejunior2020-04-17 22:41:38
C++ / C#
onlinejunior, 2020-04-17 22:41:38

How to convert a file to text format?

In general, when receiving a file from outside the web server, I need to read its contents and write out the lines, but I cannot figure out how to write the resulting file into a variable and insert it into a textbox, for example, without saving it to the local disk.

The file format is not text!

Easier - for example, I downloaded the file and opened it in notepad, then I will see something like this in it:

ftypisom isomiso2avc1mp41

Code for receiving the file:

var response = request.Get("https://site.file.com/fileD=");


How can I properly handle response ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
onlinejunior, 2020-04-17
@onlinejunior

In general, I did not find how to display the box in the text, I immediately take the data and that's it.

var response = request.Get("https://site.file.com/fileD=");
Stream responseStream = response.ToMemoryStream();

                using(StreamReader tmp = new StreamReader(responseStream))
                {
                    string title = tmp.ReadToEnd().Substring("v:", "<");
                }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question