Hello,
May I ask what built-in functions available out there in C# to search
for a particular filename input from the user at runtime ?
I am completely new to system thingies, so please help beginner. I
appreciate any answers from you. 5 1788
Hi Petrosky,
I'm not sure exactly what you're looking for -- do you want the user to
browse for a file on the system using a GUI? If so, then check out the
OpenFileDialog class. For example:
OpenFileDialog ofd = new OpenFileDialog( );
DialogResult dr = ofd.ShowDialog( );
if (dr == DialogResult.OK )
{
string filename = ofd.FileName;
MessageBox.Show (filename);
}
John
Petrosky wrote:
Hello,
May I ask what built-in functions available out there in C# to search
for a particular filename input from the user at runtime ?
I am completely new to system thingies, so please help beginner. I
appreciate any answers from you.
Sounds like your looking to find a the location of a file given the name
If so, then you could simply recursively search the drives, checking for
filenames that match. http://www.codeproject.com/csharp/RecursionInCSharp.asp http://www.codeproject.com/cs/files/findallfiles.asp
--
Regards
John Timney (MVP)
"Petrosky" <dr********@pet rosky.comwrote in message
news:ec******** **@pin6.tky.pla la.or.jp...
Hello,
May I ask what built-in functions available out there in C# to search for
a particular filename input from the user at runtime ?
I am completely new to system thingies, so please help beginner. I
appreciate any answers from you.
If you want to check that a file/directory exists then you can use the File
class:
using System.IO;
if (File.Exists(@" c:\test.dat")). ..
if (Directory.Exis ts(@"c:\myfolde r"))...
If you want information on the file (size, modify time etc.) then take a
look at the FileInfo class:
FileInfo fi = new FileInfo(@"c:\t est.dat");
fi.Length
HTH
- Andy
"Petrosky" <dr********@pet rosky.comwrote in message
news:ec******** **@pin6.tky.pla la.or.jp...
Hello,
May I ask what built-in functions available out there in C# to search for
a particular filename input from the user at runtime ?
I am completely new to system thingies, so please help beginner. I
appreciate any answers from you.
Have a look at the following site: http://www.c-sharpcorner.com/1/FindFileInCS.asp
--
Nand Kishore Gupta
"Petrosky" wrote:
Hello,
May I ask what built-in functions available out there in C# to search
for a particular filename input from the user at runtime ?
I am completely new to system thingies, so please help beginner. I
appreciate any answers from you.
Petrosky,
I think you are looking for System.IO.Direc tory.GetFiles. This method can
look for files using wildcards.
--
HTH
Stoitcho Goutsev (100)
"Petrosky" <dr********@pet rosky.comwrote in message
news:ec******** **@pin6.tky.pla la.or.jp...
Hello,
May I ask what built-in functions available out there in C# to search for
a particular filename input from the user at runtime ?
I am completely new to system thingies, so please help beginner. I
appreciate any answers from you. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Erik Andersson |
last post by:
Hi!
I need to read a file (line-by-line) in reverse order, without reading the
whole file into memory first.
Is there an easy way of doing this? As in, is there a PHP function I could
use?
The solution has to be platform independent, so "popen("tac $filename")...
wouldn't work.
|
by: sashan |
last post by:
Is the way to use DOM for an xml file as follows:
1) Read the file into a string
2) Call xml.dom.minidom.parseString(string)
|
by: travis ray |
last post by:
Hi,
I have an extension in which a file object is created in python and
passed down to a c extension which attempts to read from it or write
to it. Writing to the file pointer seems to work okay, but reading
from it results in EBADF. It also causes python to crash on exit.
I've attached the minimal (I think) c code, python code, build script,
build log, and run log. Any and all help is greatly appreciated.
|
by: Michael |
last post by:
Hi,
I moved to c++ from c, and wanted to know what the best way to read data
from files is in c++. Any thoughts? fscanf() is possible but fairly painful!
Regards
Michael
|
by: JS |
last post by:
Hello all!
I have come on to a problem for which I am not able to find a solution
searching the web.
What I am trying to do is reading a log-file with a size of 1.3 GB.
When reading it using fread() or the Visual C specific(?) read() they
return that the number of bytes read equals the number of bytes
requested, however all of the bytes read turn out to have a value of
zero (the file contains other values). When using the exact same...
| |
by: Felix85 |
last post by:
here is my method for reading in a file:
static room room::file2Room(int rnum){
ostringstream filename;
filename << "../gamefiles/rooms/" << rnum <<
".room";
ifstream infile(filename.str().c_str());
string roomNameIn, roomDescriptionIn;
int roomExitsIn;
infile >> rnum;
|
by: Girish Sahani |
last post by:
I wrote the following code to concatenate every 2 keys of a dictionary and
their corresponding values.
e.g if i have tiDict1 = tiDict1 = {'a':,'b':} i should get
tiDict2={'ab':} and similarly for dicts with larger no. of
features.
Now i want to check each pair to see if they are connected...element of
this pair will be one from the first list and one from the second....e.g
for 'ab' i want to check if 1 and 3 are connected,then 1 and...
|
by: Miner Jeff |
last post by:
Hello, I have a basic question about reading files.
I have several data files where the filenames are identical except for
a short (3 character) prefix. I inherited this code and the person who
developed it was making a duplicate of each file and then deleting the
prefix on the copied file so the following statement could read a
generic "filename":
|
by: Guido Geurs |
last post by:
I'm writing a program that list the contents of a CDrom and also the contents of the ZIP files.
When there is a bad Zip file on the CD, the program keeps traying to reed the file and after +- 50 times it gives the error and ends the function.
This function is called from an other function that scans al the files on the disc.
Is it possible to give an error but that the program continues with the next file ?
=============================...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |