Computing.Net > Forums > Programming > Java File I/O

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Java File I/O

Reply to Message Icon

Name: jerrym
Date: March 10, 2005 at 09:41:17 Pacific
OS: Win XP
CPU/Ram: 3 G
Comment:

I have two questions regarding file I/O:

(1) If I want to open data.txt in C:\test directory, how to pass
directory name to FileInputStream?

I know how to open data.txt in current directory:
FileInputStream in = new FileInputStream("data.txt")

How to pass C:\test to FileInputStream?

Is the following code right?
FileInputStream in = new FileInputStream("C:\test\data.txt")


(2) How to get a list of file names under C:\test directorr? I want to
get a vector of file names under C:\test directory. How to do this?

Thanks for your help!



Sponsored Link
Ads by Google

Response Number 1
Name: bamakhrama
Date: March 12, 2005 at 08:46:47 Pacific
Reply:

Hi,
1) Yes, you can use that kind of addressing.

2) Have a look on class java.io.File under the Java API.

--
mohameda@ieee.org


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Java File I/O

Simple text file I/O www.computing.net/answers/programming/simple-text-file-io-/4829.html

C File I/O very important please he www.computing.net/answers/programming/c-file-io-very-important-please-he/7820.html

c++ file I/O, open/close file www.computing.net/answers/programming/c-file-io-openclose-file/11306.html