We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Reading file from specified directory?
Page Index Toggle Pages: 1
Reading file from specified directory?? (Read 337 times)
Reading file from specified directory??
Apr 28th, 2008, 4:02pm
 
I am currently doing a project. Which involves capturing from the webcam, then process the image and then output it on the screen.
Because I need to do addition to the frames captured, so I wrote two programs instead. The first one read from the webcam, capture pictures in every two seconds. The second one read the saved pictures, process them and display.

My problem is, the saved file is saved at my first program's sketch folder, and the second program just read thing from it's own sketch folder. Can I specify the location where the second program reads from? Or is there any alternatives?
Please kindly provide me some directions, suggestions or solutions! With a lot of thanks =]
Re: Reading file from specified directory??
Reply #1 - Apr 28th, 2008, 5:50pm
 
Try using the java.io package - java.io.file

something like this:

Code:

import java.io.File;

//create directory
myFile = new File("c://...path to directory parent...");
myFile.mkDir();

//and then read from directory
String [] fileList = new String [];
for(int i=0; i<fileList.length; i++)
loadImage(myFile.getPath() + "\\" + fileList[i]);



(code is not checked in any way)
Page Index Toggle Pages: 1