file

Reading from a file in assembly

I'm trying to learn assembly -- x86 in a Linux environment. The most useful tutorial I can find is Writing A Useful Program With NASM. The task I'm setting myself is simple: read a file and write it to stdout. This is what I have: section .text ; declaring our .text segment global _start ; telling where pr...

Can we commit individual files??

Hello we are using CVS and development takes place regularly. I work only on one-three files most of the time. Do I still have to commit all the changes in the folder?? Is it possible to select the files which have to be committed and not allow the CVS to commit files which are still in development?? As in file 1, file 2 and file 3....I...

Python search file using wildcard

If I want get a list of filenames with a search pattern with wildcard. Like: getFilenames.py c:\PathToFolder\* getFilenames.py c:\PathToFolder\FileType*.txt getFilenames.py c:\PathToFolder\FileTypeA.txt How to do this? Thanks. ...

Protect link for public downloads

I've got SL application where i should implement file managment subsystem. I've got hierarchical structure of files\folders(just description). Also each file\folder has its own permissions to users\groups. I would like implement that one user who has permission to download file couldn't give it to another user, who hasn't this permission...

Reading file using fscanf() in C

I need to read and print data from a file. I wrote the program like below, #include<stdio.h> #include<conio.h> int main(void) { char item[9], status; FILE *fp; if( (fp = fopen("D:\\Sample\\database.txt", "r+")) == NULL) { printf("No such file\n"); exit(1); } if (fp == NULL) { printf("Error Reading File\n"); } while(...

fopen without fclose in C

Hi All, What happens if i open a file using fopen some n number of times without calling fclose on it? Any buffer overrun issues may arise? ...

Java, IO - fastest way to remove file.

Hey guys, My problem is that I have an app which is writing a lot of relatively (100-500kb) small CSV files (tens and hundreds of thousands ). Content of those files then get loaded in database via sql loader call (its oracle db) and this is what I have to live with. So, I need to remove those small files time to time to prevent them...

Suggestions for passing large table between Python and C#

I have a C# application that needs to be run several thousand times. Currently it precomputes a large table of constant values at the start of the run for reference. As these values will be the same from run to run I would like to compute them independently in a simple python script and then just have the C# app import the file at the ...

Server not able to properly read/open a filename sent by client in C

Hi, I'm doing client/server interaction with sockets in C. What I'm trying to do is have the client request a file to be read on the server, the server return a buffer of the file contents, and the client print out the file. Though I was able to accomplish the server sending a buffer of a file to the client & the client printing it out ...

PHP - CSV file overwriting based on UID.

I know I know, a database would be the better idea with what I want to do, but I don't want the hassle of dealing with a database and learning stuff. I have a CSV that has something similar to TestUser,2010/07/27 13:26:25,2010/07/27 13:26:29,0.0011,0.0006,0.06 TestUser,2010/07/27 14:22:12,2010/07/27 14:22:24,0.0033,0.0027,0.27 TestUse...

Using an empty file to have one application instance

There's probably other ways of doing this but I'd like to use an empty file to have one instance of an application running at a given time. This would be done by creating the file when the application is launched and have other application instances exit as soon as they detect the file. The trouble with this approach is that the file ca...

fread returns zero

I have a function that reads a rom file into memory and automatically allocates to fit the file but every time I try to read from the file descriptor, fread() returns zero. I'm unsure what I'm doing wrong. can anybody help? int read_rom(const char *filename, unsigned char ***rom) { int rom_size; FILE *fd = NULL; if((fd = fopen(file...

how to sort file in ruby.

This is my file content. Receivables=Por cobrar Payables=Cuentos por pagar ytdPurchases.label=Purchases YTD validationError.maxValue=Value is too large, maximum value allowed is {0} i want to sort this content in alphabetic order ... how may i do that ?? Update: This code will sort my file. new_array = File.readlines("#{$base_prope...

Groovy parsing text file

I have a file log that I would like to parse and am having some issues. At first it seemed it would be simple. I'll go ahead and post the source I have come up with and then explain what I am trying to do. The file I'm trying to parse contains this data: HDD Device 0 : /dev/sda HDD Model ID : ST3160815A HDD Serial No : 5RA020QY HDD Re...

How to get a single file from a folder in java?

The idea is to take one single file, but I don't want to list all the files, I have the address of the specified folder, but not the name. Basically I want findFileInFolder(String folderName) --- this method returns a random filename or the oldest file created on the folder Does anybody ever tryied doing this? any Ideas to avoid listi...

check if the file exists, if not, create

how do i check using php dom, if an xml file exists, and if not create it. <?php header("Location: index.php"); $xmldoc = new DOMDocument(); $xmldoc->load('sample.xml'); $newAct = $_POST['activity']; $root = $xmldoc->firstChild; $newElement = $xmldoc->createElement('activity'); $root->appendChild($newElemen...

How to get the file with latest lastModified date, in Java?

I have a directory of files that I need to check for changes. I consider it changed when one of the files has a modifiedDate newer than what I remembered from the last check (this is meant to be a cache dependency). What would be the fastest way of finding the latest modified file in a directory in Java? Maybe I'm too optimistic, bu...

PHP fopen using file mask

Is it possible/how can I open a text file in PHP using a file mask? The files are going to be named for example: abcdef_072810_999222.txt abcdef_072910_123456.txt abcdef_073010_888884.txt So I want to fopen or rename the file like this (notice the * mask) : "abcdef_".date("mdy")."_*.txt" I would like to avoid a read directory conte...

What permissions must be granted for applets to write temporary files?

We're developing an applet and need it to be able to read/write files in the user's temporary files directory (e.g. C:\Documents and Settings\USERNAME\Local Settings\Temp). The applet is signed, the user clicks the 'allow' option on applet startup, and the Java Control Panel has "Allow user to grant permissions to signed content" and "...

php upload file class

hi all, i am new to php i am in search of a php function in a class that accepts some parameters like size,type etc the class should be such that it should be able to set some default values to the parameters that are not assigned by user for ex the destination folder etc can anybody give me a link or some hint how should i do this ...