In an MFC application, what's the easiest way to copy a file from one directory to another?
Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me? ...
Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me? ...
I'm using: FileInfo(System.Environment.GetFolderPath(System.Environment.SpecialFolder.ProgramFiles) + @"\MyInstalledApp" In order to determine if a program is detected on a users machine (it's not ideal, but the program I'm looking for is a right old kludge of a MS-Dos application, and I couldn't think of another method). On XP and 3...
Is it possible to read damaged media (cd, hdd, dvd,...) even if windows explorer bombs out? What I mean to ask is, whether there is a set of APIs or something that can access the disk at a very low level (below explorer?) and read whatever can be retrieved even if it is only partial, especially if you can still see the file is there fro...
I need to change the capitalization of a set of files in a subversion working copy, like so: svn mv test.txt Test.txt svn mv test2.txt Test2.txt svn mv testn.txt Testn.txt ... svn commit -m "caps" How can I automate this process? Standard linux install tools available. ...
I can currently to the following: class SubClass extends SuperClass { function __construct() { parent::__construct(); } } class SuperClass { function __construct() { // this echoes "I'm SubClass and I'm extending SuperClass" echo 'I\'m '.get_class($this).' and I\'m extending '.__CLASS__; } } I would like to do som...
I've created a PHP DOM xml piece and saved it to a string like this: <?php // create a new XML document $doc = new DomDocument('1.0'); ... ... ... $xmldata = $doc->saveXML(); ?> Now I can't use the headers to send a file download prompt and I can't write the file to the server, or rather I don't want the file laying aro...
I am trying to use a StreamReader to read a file, but it is always in use by another process so I get this error: The process cannot access the file '\arfjwknasgmed17\C$\FLAG CONDITION\CP-ARFJN-FLAG.XLS' because it is being used by another process. Is there a way I can read this without copying it? Or is that my only option?...
Given two absolue paths, e.g. /var/data/stuff/xyz.dat /var/data How can one create a relative path that uses the second path as its base? In the example above, the result should be: ./stuff/xyz.dat ...
I have an automated test running on my program that generates some large MPG files along with other files. After running the test, I have the script clean up after itself. The other files (a mix of binary and text files) are removed with no problems. The MPG files, however, don't get deleted. If I try and manually delete the MPG file...
How you can read a file (text or binary) from a batch file? There is a way to read it in a binary mode or text mode? ...
Hi, I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and which is a file with no file extention. Does anyone know how to tel...
I am using ASP.NET to transmit a .jar file. This code works perfectly on IE. However on Firefox the file downloads, corrupt. What is the best way to fix it? Below is the code I am using. private void TransferFile() { try { string filePath = Server.MapPath("SomeJarFIle.jar"); FileInfo file = new FileInfo(file...
Yes, There's More Than One Way To Do It but there must be a canonical or most efficient or most concise way. I'll add answers I know of and see what percolates to the top. To be clear, the question is how best to read the contents of a file into a string. One solution per answer. ...
I have a symlink to an important directory. I want top get rid of that symlink, while keeping the directory behind it. I tried 'rm' and get back "rm: cannot remove 'foo'". I tried 'rmdir' and got back "rmdir: failed to remove 'foo': Directory not empty" I then progressed through 'rm -f', 'rm -rf' and 'sudo rm -rf' Then I went to find...
Hi, I'm currently creating a website for a client that will basically involve selling various files. This is obviously a really common thing to do, which is making me feel kind of foolish for not thinking of a method for doing it. Once the purchase has been made the customer should be taken to a page containing the download link, as wel...
I have to copy quite a lot of files from one folder to another. Currently I am doing it in this way: string[] files = Directory.GetFiles(rootFolder, "*.xml"); foreach (string file in files) { string otherFile = Path.Combine(otherFolder, Path.GetFileName(file)); File.Copy(file, otherFile); } Is that the most efficient way? Seem...
I have a SQL Server 2005 sp2 box where tempdb has either 8 data files or 5 data files dependingo n where you look. DBCC showfilestates and sys.database_files (both queried in tempdb) show 8 data files (tempdev - tempdev8), however when I query sys.master_files (in master db, which is also what the GUI uses), I only see 5 (tempdev, tempd...
When you use the PHP copy function, the operation blindly copies over the destination file, even if it already exists. How do you copy a file safely, only performing the copy if there is no existing file? ...
Hello. I'm fairly new to JavaScript. Given a local machine's folder path (Windows), I was wondering how you can extract the names of all the possible folders in the current path, without the knowledge of how many folders there are or what they are called. Thank you very much in advance. ...
If I have a source.c file and it uses a structure like struct a { int i; struct b { int j; } }; if this structure is to be used by some other file func.c how to do it? shall we open a new header file and declare the structure there and include that header in the func.c? or can we define the total structure in ...