file

Issue on file existence in C

Hi All, Here is my code which checks if the file exists : #include<stdio.h> #include<zlib.h> #include<unistd.h> #include<string.h> int main(int argc, char *argv[]) { char *path=NULL; FILE *file = NULL; char *fileSeparator = "/"; size_t size=100; int index ; printf("\nArgument count is = %d", argc); if (argc <= 1...

file extension .csp

Hi I found few web pages with the .csp extension. http://demo.e-dendrite.com/csp/bstent/frontpages/bdsrfront.csp http://demo.e-dendrite.com/CSP/ivf/Frontpages/ivrfront.csp what is it? what is it used for? thanks ...

which type of files are forbidden to upload

I want to put a section in my site where people can upload things and I was wondering which type of files I should forbid for them to upload. ...

Need to copy remotely hosted file via Shell Command

There is a file that hosted remotely on a server that is not supporting Shell Access. I bought a new server that supports Shell Access so now I want to copy a file that is on the non-supporting server to new server via a Shell Command using Putty. The file URL is like this http://www.domain.com/file.gzip and it is username/password prot...

save remote files from a blackberry app

Hello, How do I save a remote file (i.e. http://example.com/somefile.pdf) to blackberry's local disk from my custom app Thanks ...

Conditional action based on whether any file in a directory has a ctime newer than X

I would like to run a backup job on a directory tree from a bash script if any of the files have been modified in the last 30 minutes. I think I can hack together something using find with the -ctime flag, but I'm sure there is a standard way to examine a directory for changes. I know that I can inspect the ctime of the top level direct...

Accessing Password Protected Network Drives in Windows in C#?

Hi Everyone, So in C# I am trying to access a file on a network, for example at "//applications/myapp/test.txt", as follows: const string fileLocation = @"//applications/myapp/test.txt"; using (StreamReader fin = new StreamReader(FileLocation)) { while(!fin.EndOfStream()){ //Do some cool stuff with file } } Howeve...

C++ write to front of file

I need to open a file as ofstream and write to the front of the file, while preserving the remaining contents of the file, which will be "moved". Similar to "prepend" a file. Is this possible using the STL or boost ? ...

Fastest Java way to remove the first/top line of a file (like a stack)

I am trying to improve an external sort implementation in java. I have a bunch of BufferedReader objects open for temporary files. I repeatedly remove the top line from each of these files. This pushes the limits of the Java's Heap. I would like a more scalable method of doing this without loosing speed because of a bunch of construc...

How can I programmatically tell if a caught IOException is because the file is being used by another process, without resorting to parsing the exception's Message property?

When I open a file, I want to know if it is being used by another process so I can perform special handling; any other IOException I will bubble up. An IOException's Message property contains "The process cannot access the file 'foo' because it is being used by another process.", but this is unsuitable for programmatic detection. What is...

File hash: Does it change for same content but in different order?

Let's say there is a file called myfile.txt with the following contents: one two three Another file called yourfile.txt with following contents: two three one Will the SHA-1 hash be the same for both of these files, because the content are same but in different order? ...

Check if filename Exists? .NET

I find myself doing this a lot just to ensure the filename is not in use. Is there a better way? Directory.Exists(name) || File.Exists(name) ...

Java: one-liner to add things to a declared File[]?

The directoryReader gets you dirs in current dir in File[]-format. Code DirectoryReader data = new DirectoryReader(); File[] dirs = data.getDirsInDir("."); File[] dirsMore = data.getDirsInDir(".."); // How can I append dirsMore to dirs-file[]? ...

In Java, howd do I iterate through lines in a textfile from back to front

Basically I need to take a text file such as : Fred Bernie Henry and be able to read them from the file in the order of Henry Bernie Fred The actual file I'm reading from is >30MB and it would be a less than perfect solution to read the whole file, split it into an array, reverse the array and then go from there. It ...

return a js file from asp.net mvc controller

Hi all fellow programmer I'd like to have a separate js file for each MVC set I have in my application /Controllers/ -TestController.cs /Models/ /Views/ /Test/ -Index.aspx -script.js And I'd like to include the js in the Index.aspx by <script type="text/javascript" src="<%=UriHelper.GetBaseUrl()%>/Test/Js"></...

How third-party SQL Server backup tools access databases' files for backup?

I'm reading about Red Gate SQL Backup, and I liked the concept of creating a database backup compressed and writing on disk the compressed backup directly without an intermediate SQL Server native backup. And I'm wondering how this type of software make backups. It accesses the database files directly? It uses some sort of SQL Server o...

load Javascript object from file

Hi there, I asked a question in this thread Stackoverflow, and it works perfect. So tnx to all the users who gave me a reply. But now I have a other question. I would like to have the object in a seperate file, so I only need to update the file in stead of the JS file (otherwise it will be very big). I'm using JQUERY. I now looks like...

PHP file that should run once and delete itself. Is it possible?

PHP file that should run once with no errors and delete itself. Is it possible? How to create such file? ...

How can I dynamically load and execute all of the Javascript files in a directory?

I'm making a very simple content-management system in Javascript. It uses plugins which are individual .js files which live in a "modules" folder. Currently I'm loading them with JQuery's getScript() function, but I have to manually define the list of available modules. Is there any way to dynamically load the list of Javascript files s...

how to save a captured screenshot locally in chrome plugin?

how to save a captured screenshot locally in chrome plugin? I m stuck badly. If it can be done by only npapi than please give me some examples. Please do help me. Thanx in advance. ...