android write a file in /dev
<p>I am trying to write a file to /dev and the code is as below i get an error in the log.what am i doing wrong..I am using the emulator to test this..Should this be done on the actual device?</p>

<pre><code>  try {
        process = Runtime.getRuntime().exec("su");
        OutputStream os = process.getOutputStream();
        DataOutputStream dos = new DataOutputStream(os);
        String cmd = "echo 'hello world'&gt; /dev/pttycmd1";
        String  cmd1 = "echo 'hello world2'&gt; /dev/pttycmd2";
        dos.writeBytes(cmd);
        dos.writeBytes(cmd1);
        dos.flush();
        File f = new File("/dev/pttycmd1");
        if(f.exists())
        { 
             /* do something */ 
            Log.d("success", "File exists");
        }
        else
        {
            Log.d("error", "File does not exists");
              //file.mkdirs();
              //And your other stuffs goes here
        }
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
</code></pre>
