locked
want to read binary file into string... RRS feed

  • Question

  • User518433182 posted

    hi ,

    i am working on the mobile application, and i want to read binary file .. its just contains the string.. e.g "hi Wel come".

    i have opened that file using filestream and try to read that file using binaryReader.. but it didn't read that file correctly...

    if i use binaryreader.readstring();

    it throws an exception of endOfstream...

    when i stored that stream into array of byte and read it through response.binaryWrite.... like

    Response.clear();

    Response.BinaryWrite(buffer);

    Response.flush();

    Response.close();

    Response.end();

    it shows me the correct result as i want ..i.e it shows the "hi wel come" on browser...

    like this i want to store that content of file into string ..

    so how is it possible.... its urgent plz

    Sunday, March 27, 2011 3:33 AM

All replies

  • User1943143334 posted

    Hi,

    Check the following link

    http://www.c-sharpcorner.com/Resources/733/

    Hope it helps u...

    Sunday, March 27, 2011 1:43 PM
  • User518433182 posted

    no its not i want. i want to read .dat file .and it contains some text then how can i read that .dat file and store its text content into string. i have tried with

    binaryreader br=new binaryreader(fs);

    br.readString();

    but it throws me an exception "EndOfStreamException".

    but if i read all the contents into array of bytes and read it using response.binarywrite(buffer);

    it reads it correctly...

    i want the same i want to store the text into the string ... so plz 

    Monday, March 28, 2011 12:42 AM