Sunday, May 4, 2008

My first day in C++ .Net.

The first application that adopts this technology is my search file console program. The objective of this program is to retrieve all the files by searching through the particular location (including the remote media and network media).

I am having trouble at the first run. I mean every time I start something new, I’ll create a simple “Hello World” program to make sure everything are in place. “Something new” means this my first time in .Net development. The compiler that I am using is Express Edition 2005. At first I create an empty project from the general category. When I build the program by choosing “Start without Debugging” option, everything went fine. But it will prompt a message if I build using “Start Debugging” option.

The contents of the message are as below:

Debugging information for 'XXX.exe' cannot be found or does not match. Binary was not build with debug information.

This is not an error I guess, it just unable to retrieve the debug information. I do not know how to solve this problem, if you read this post and have any suggestion on this, do let me know. Thus I have to recreate the project by choosing “Win32 Console Application” under the Win32 category.

Now, the primary keys to deal with Files are DirectoryInfo, FileSystemInfo, and FileAttributes. The sample below will show all the files (not directory) in C drive.

DirectoryInfo ^di = gcnew DirectoryInfo("C:\\");

for each(FileSystemInfo ^fsi in di->GetFileSystemInfos())

if(fsi->Attributes != FileAttributes::Directory)

No comments: