Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » FileSel&FileList, Path » FindFile Problem
FindFile Problem [message #16863] Thu, 17 July 2008 19:19 Go to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
What is wrong with this code?

#include <Core/Core.h>

using namespace Upp;

CONSOLE_APP_MAIN {

	Vector<String> cmd = CommandLine();
	
	String dirName = cmd.At(0);
	FindFile ff(dirName);
	String fileName;
	size_t fileSize;

	do {

		fileName = GetFileDirectory(dirName) + ff.GetName();
			
		if (ff.IsDirectory()) {
			
			LOG("Directory:\t" << fileName);
			Cout() << "Directory:\t" << fileName;
			
		} else {
		
			LOG("File:\t" << fileName);
			Cout() << "File:\t" << fileName << "\n";

			if (!f.Open(fileName)) {
				Cout() << "ERROR: Cannot open file " << fileName << "!\n";
				exit(-1);
			}
			
			fileSize = f.GetSize();

			LOG("Size:\t" << fileSize);
			Cout() << "Size:\t" << fileSize << "\n";
			
		}

	} while(ff.Next());
}

I only get the first directory or file with the command line argument: c:\temp\*.

WinXP, 806.r125

Matthias
Re: FindFile Problem [message #16870 is a reply to message #16863] Fri, 18 July 2008 11:20 Go to previous messageGo to next message
masu is currently offline  masu
Messages: 378
Registered: February 2006
Senior Member
The code is correct, but the exe call was wrong.

When I call the application from the cmd line with
"c:\temp\*"
everything works fine, because the shell expansion is suppressed by '"'.

But when I call it from within TheIDE (setting the parameter in run options), what I get is c:\temp\* and then the shell expands it to the list of file and dirs and as a result I only get the first list entry. Also
\"c:\temp\*\"
does not work from within TheIDE.

Matthias
Re: FindFile Problem [message #16881 is a reply to message #16870] Sat, 19 July 2008 09:42 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Interesting...

Mirek
Previous Topic: FileSel ExecuteSaveAs replace file prompt bug
Next Topic: knowing extinsion and name
Goto Forum:
  


Current Time: Fri Mar 29 16:16:47 CET 2024

Total time taken to generate the page: 0.01705 seconds