10 messages in com.googlegroups.android-beginnersRead/Write Binary files
FromSent OnAttachments
Tang200811 Feb 2008 19:24 
Dan U.11 Feb 2008 20:56 
Tang200811 Feb 2008 23:18 
Dan U.11 Feb 2008 23:29 
Tang200813 Feb 2008 03:55 
Michael Wittke13 Feb 2008 04:20 
Tang200813 Feb 2008 05:23 
Michael Wittke13 Feb 2008 05:37 
Tang200813 Feb 2008 17:53 
Dan U.13 Feb 2008 19:30 
Subject:Read/Write Binary files
From:Tang2008 (tass@hotmail.com)
Date:02/11/2008 07:24:37 PM
List:com.googlegroups.android-beginners

Dear all,

Could you do me a favor? I want to read and write binary files. my code is as follow

//////////////////////// my code ///////////////// public static void writefile() { Context context = new Context(); try{ FileOutputStream os = context.openFileOutput("testdata.bin",

MODE_WORLD_WRITEABLE ); os.write(1); os.close(); }catch(Exception ex) { } } /////////////////////////////////////////////////////////////

There are some error message: "Cannot instantiate the type Context." And I do not know what path should the binary files be placed.

Can someone give me a simple and complete example code how to read/write binary files.

Thanks a lot.