file

Reading long ASCII-files in C.

In C, if I read a line from the file by function fgetc, there might be a stack overflow. Suppose that some has written a program which outputs a a huge line of ASCII data in one line on a particular file. How can I read that data in my C program to screen? I know that I can read only, say 100 character at once but I don't know how can I ...

need to explode a text/csv file uploaded from form

When i use an html form to post a file, how do i address that file's contents in php? will this work? $data = $_POST['file']; $pre = explode(";;;", $data); the file is a text file btw UPDATE the csv is field enclosed with ::: and lines terminated by ;;;. How can i load this into a variable without breaking the php script, which is w...

Writing Encoded Objects to File

Hi all, I'm looking for a low-level encryption to write questions/answers for a test/exam application in Java. Both the questions and exam are objects. Basically, I need a way to serialize a object, write it to a file, whilst encrypting everything so no one can read the question/answers without my program. I've heard of Protocol Buffer...

How to determine if a file is in a removable drive or in the local drive

How do you determine if a file is on a removable drive or in the local drive in vc++? ...

Easiest way to have a true "file tasks" in ANT

I am still learning how to use ANT well, and I wanted to understand if there is some reasonable way to do file tasks in it, similar to Rake and Make: http://martinfowler.com/articles/rake.html#FileTasks "With a file you are referring to actual files rather than task names. So 'build/dev/rake.html' and 'dev/rake.xml' are actual files. T...

C# MSI Installer file/folder permissions

Hi, I'm trying to install a set of files within the programdata folder using basic MSI installer. As the content of the files are dynamic and generated during the installation process, I'm creating the files in C# code during installation. The files are created in the appropriate folders, and everything is good, except the files permi...

Eclipse plugin: create a new file

Hi, I'm trying to create a new file in an eclipse plugin. It's not necessarily a Java file, it can be an HTML file for example. Right now I'm doing this: IProject project = ... IFile file = project.getFile("/somepath/somefilename"); // such as file.exists() == false String contents = "Whatever"; InputStream source = new ByteArrayInput...

Amazon S3 - Posting form using html and PHP content-disposition problem

I am having trouble putting files onto my S3 account using http post. Everything is working great, but I want the key and filename to be different. I'm specifying the key just fine and my policy doc is working fine too. I include this line in my policy doc ["starts-with", "$Content-Disposition", ""] and this is the input for my Conten...

bzr: Restoring a deleted file after some commits with bazaar

Hi everybody ! I'd like to know if it is possible to restore a removed file from an older revision (a clean way to do it) I've renamed a file for some tests, than I commited all my work (and I forgot to rename the file) and did a lot of other commits... When I realised, it was too late... Regards, Ayman ...

Why doesn't my CGI script's "die" message display in the browser?

I'm trying to copy some files from one network share to another using File::Copy. This is my code #!C:/strawberry/perl/bin/perl.exe use File::Copy; print "Content-type: text/html\n\n"; print "<H1>Hello World</H1>\n"; copy("s:\\nl\\cover\\config.jsp", "s:\\temp\\config.jsp") or die "File cannot be copied."; print "this is no...

Download file using libcurl in C/C++

Hi! I am building an application (on windows using Dev-C++) and I want it to download a file. I am doing this using libcurl (I have already installed the source code using packman). I found a working example (http://siddhantahuja.wordpress.com/2009/04/12/how-to-download-a-file-from-a-url-and-save-onto-local-directory-in-c-using-libcurl/)...

Remove html formating "&gt;" from text file using Python csv.reader

I have a text file with ; used as the delimiter. The problem is that it has some html text formating in it such as &gt; Obviously the ; in this causes problems. The text file is large and I don't have a list of these html strings, that is there are many different examples such as $amp;. How can I remove all of them using python. The fil...

Performance: Templates in a Database or a File?

What is the fastest way to store templates? In a database (SQL Server) or a file? Those template can be from 1KB to ~15KB (usually 1-3KB). After reading the template, I'm parsing it with Regex to HTML. I've <div>[Block Parameter="Value" Parameters2="SomeValue" ...]</div> for example, so please consider that. Thanks. ...

What type of file deletes itself as soon as the handle is closed?

Let's say I have a Windows application that creates a file and writes data to it. The application has opened the file exclusively so no other processes can read the data in the file. If the process is killed, the file is deleted. If the process is suspended and the handle to the file is closed (using Process Explorer), the file is dele...

Fgets in C++ repeats last line

I have program like (from link text) FILE* soubor; char buffer[100]; soubor = fopen("file","r"); string outp = ""; while (! feof(soubor)) { fgets(buffer,100,soubor); fputs (buffer , stdout); } fclose(soubor); and file like A B C D E and the output of program is A B C D E E it repeats last line of file twice. I ha...

Close all opened xml tags

Hello, I have a file, which change it content in a short time. But I'd like to read it before it is ready. The problem is, that it is an xml-file (log). So when you read it, it could be, that not all tags are closed. I would like to know if there is a possibility to close all opened tags correctly, that there are no problems to show it...

insert string in the middle of a file given a file object

I am working on a problem and got stuck at a wall I have a (potentially large) set of text files, and I need to apply a sequence of filters and transformations to it and export it to some other places. so I roughly have def apply_filter_transformer(basepath = None, newpath = None, fts= None): #because all the raw studies in basepa...

problem when re-running program

I have a fairly simple python loop that calls a few functions, and writes the output to a file. To do this is creates a folder, and saves the file in this folder. When I run the program the first time with a unique file name, it runs fine. However, if I try to run it again, it will not work and I do not understand why. I am quite certai...

Flex: Download file & close new window/tab in IE

Hello everybody, I'm getting an anoying problem in IE6.02 when trying to download a file through flex + struts action, the browser opens a new window and doesn't close it after the download has finished. The flex code is: navigateToURL(url,"_blank"); The content headers are: HTTP/1.x 200 OK Date: Thu, 29 Oct 2009 22:00:44 GMT Transf...

ifstream: how to tell if specified file doesn't exist

I want to open a file for reading. However, in the context of this program, it's OK if the file doesn't exist, I just move on. I want to be able to identify when the error is "file not found" and when the error is otherwise. Otherwise means I need to quit and error. I don't see an obvious way to do this with fstream. I can do this wi...