Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 567123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:02:59+00:00 2026-05-13T13:02:59+00:00

I found out that you can use something like this to create a file:

  • 0

I found out that you can use something like this to create a file:

FileOutputStream  fs = openFileOutput("/test.in", MODE_WORLD_WRITEABLE);
String s = "[Head]\r\n";
s += "Type=2";
byte[] buffer = s.getBytes();
fs.write(buffer);
fs.close();

When running the above code I get an IllegalArgumentException stating:

java.lang.IllegalArgumentException:
File /test.in contains a path
separator

and I’m guessing the “/” is not appreciated. I wanted the “/” since I need to write the file to the root directory of the device, as stated in the API in trying to follow:

A request is a textfile (UNICODE) with
the file extension “.in”. The
application reads and parses the .in
file when it’s placed in root
directory on the mobile device.

Question is: how do I place a file in the root-directory? I have been looking around for an answer, but haven’t found one yet.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T13:02:59+00:00Added an answer on May 13, 2026 at 1:02 pm

    Context.openFileOutput is meant to be used for creating files private to your application. they go in your app’s private data directory. you supply a name, not a path: “name The name of the file to open; can not contain path separators”.

    http://developer.android.com/reference/android/content/Context.html#openFileOutput(java.lang.String, int)

    as for your question, you can’t write to / unless you’re root:

    my-linux-box$ adb shell ls -l -d /
    drwxr-xr-x root root 2010-01-16 07:42
    $

    i don’t know what your API is that expects you to write to the root directory, but i’m guessing it’s not an Android API and you’re reading the wrong documentation 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found out that I can use a different theme in an C# WPF
not so long ago i found out that you can do this in css
I found this SVG file online that I want to use with Raphael, so
In my search i found out that we can generate private key called myrsakey.pem.What
Recently I found out that there are several things that one can do to
Today, I found out that you can write such code in C++ and compile
I am learning JSON, but I found out that you can put what are
From the Jobeet tutorial provided in Symfony website, I found out that I can
I found out during the debug that my db is in: /data/data/package-name/databases/... how can
I am querying an HTML file with LINQ-to-XML. It looks something like this: <html>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.