file

File copying in Java

What is a better option (in terms of performance): copying a file using fileinputstream and fileoutputstream or running a OS specific command copy command from Java? ...

C# can read from a file that doesn't exist?

Hi, We have some C# code that reads data from a text file using a StreamReader. On one computer we can read data from the text file even after it has been deleted or replaced with a different text file - the File.Exists call reports that the file exists even when it doesn't in Windows Explorer. However, on another computer this behaviou...

split a file into segments?

I have a file containing text data which are separated by semicolon ";". I want to separate the data , in other words split where ; occurs and write the data to an output file. Is there any way to do with bash script? ...

How do I read and edit a .txt file in C#?

For example, I have a txt file that reads: 12 345 45 2342 234 45 2 2 45345 234 546 34 3 45 65 765 12 23 434 34 56 76 5 I want to insert a comma between all the numbers, add a left brace to the begining of each line and a right brace to the end of each line. So after the editing it should read: {12, 345, 45} {2342, 234, 45, 2, 2, 4534...

Reading ints from file with C

Hello. This is a very simple question, but I can't seem to find something about it in here already. I want to read two integers from a file with C. My code now is this: int main() { FILE *fp; int s[80]; int t; if((fp=fopen("numbers", "r")) == NULL) { printf("Cannot open file.\n"); } else { fscanf(fp,...

File open: Is this bad Python style?

To read contents of a file: data = open(filename, "r").read() The open file immediately stops being referenced anywhere, so the file object will eventually close... and it shouldn't affect other programs using it, since the file is only open for reading, not writing. EDIT: This has actually bitten me in a project I wrote - it prompte...

How do I make a .net assembly filesize as small as possible?

I have a .net assembly that contains data access code (a bunch of Typed Datasets and helper classes) that is quite large on disk (~2.5MB). What can I do to work out why it's so big and make it smaller? ...

delphi - watching for files changes in directories - implemented in JCL?

Hi, I need to notify my application in some way whenever any file in the given directory has been changed (its content has been modified) ... is there any JCL/JVCL routine for that? Thanks in advance ... ...

var paragraph is giving me "unterminated string constant" error

I have this file var paragraph = "Abandon| give up or over| yield| surrender| leave| cede| let go| deliver| turn over| relinquish| depart from| leave| desert| quit| go away from| desert| forsake| jilt| walk out on | give up| renounce| discontinue| forgo| drop| desist| abstain from| recklessness| intemperance| wantonness| lack of r...

Visual Studios: Getting standard font... files?

I've run into another problem while fixing up my game to use this library. SDL.NET, the library I'm using for graphics and input in my VB.NET app, has its own special Font class which is entirely separate from System.Drawing.Font. Here are its two constructors: public Font(string fileName, int pointSize) public Font(byte[] array, int p...

Fastest way to copy text from a File to a HttpServletResponse

Hi, I need a very fast way to copy text from a file to the body of a HttpServletResponse. Actually I'm copying byte by byte in a loop, from a bufferedReader to the response.getWriter() but I believe there must be a faster and more straightforward way of doing it. Thanks! ...

problem opening file c++

Must be a simple answer but I am at a loss, here is the code that is returning an error. I have tried with and without the starting slash. I won't know the full path, I want it to be relative from the exe, and that is the relative path. I tried escaping the slashes. My problem is that i get "error opening file" when the file is there. ...

Java - Find a line in a file and remove

I was digging on the internet to find a small code snippet that will find a line in file and remove that line (not content but line) but could not find. So for example I have in a file following: File myFile.txt aaa bbb ccc ddd Need to have a function like this: public void removeLine(String lineContent), and if I pass removeLine("...

IPhone - Get file last modified date from web server

I want to check the last modified date on a file on a web server. Any help would be great. Thanks. ...

MFC: disable New File and Save File features in SDI application

What would be the easiest way of using commands in the code to programatically disable these two features in an application? Thanks in advance. ...

Need Database autonumber functionality in files (Windows C#)

I need to store set of key-value pairs in a file. values are name of persons and keys should be auto generated and are hidden to user (like auto-number in database but I do not need DB) how should I do this? ...

How to check if a file exists and is readable in C++?

I've got a fstream my_file("test.txt"), but I don't know if test.txt exists. In case it exists, I would like to know if I can read it, too. How to do that? I use Linux. ...

How to retrive and download server files (File.Exists and URL)

Hi, I have a database table where the user marks files to be downloaded. Subsequently, I browse this table and need to create a fileList to pass to an ActiveX downloader. My routine works locally and on the server for ONLY the first file. I know my logic must be bad, but I cannot find it. All of these files are always in the same s...

Java: Find .txt files in specified folder

I need Java code that will parse a given folder and search it for .txt files. Any links or code samples will be helpful. Thanks, Sri ...

Django package multiple files in a single download

In Django I'm looking for a way to serve several different files at once. I can't use static archives (.zip, .tar, etc.) because I don't have enough storage to cache these files and it will take far too long to generate them on the fly (each could be in the 100s of megabytes). Is there a way I can indicate to the browser that several fi...