all groups > vj# > june 2004 >
You're in the

vj#

group:

how do i list directory files with j++?


how do i list directory files with j++? chris
6/29/2004 4:25:01 PM
vj#:
I've tried using list(), but i get told that it is not part of the File class. am i using the wrong library? or something else stupid. i would appreciate some help, thanks
RE: how do i list directory files with j++? sadar.vjcr NO[at]SPAM online.microsoft.com
7/2/2004 4:23:42 AM
Hi,
Here is the code I used to list the directory using java.io.File. Is this
what you were trying to do? Can we see a code snippet?

[quoted text, click to view]
public class dirlist {
public static void main(String [] args) {
java.io.File file = new java.io.File("C:\\temp");
String [] list = file.list();
if (list != null) {
for (int i = 0; i< list.length; i++) {
System.out.println(list[i]);
}
}
}
}

[quoted text, click to view]

BTW, I have missed out error checking in this snippet.

Thanks
Sadagopan Rajaram
Microsoft Visual J# .NET Product Team.

This posting is provided "AS IS" with no warranties, and confers no
rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm


--------------------
[quoted text, click to view]
class. am i using the wrong library? or something else stupid. i would
appreciate some help, thanks
[quoted text, click to view]
AddThis Social Bookmark Button