write

C# file read/write fileshare doesn't appear to work

Hi, My question is based off of inheriting a great deal of legacy code that I can't do very much about. Basically, I have a device that will produce a block of data. A library which will call the device to create that block of data, for some reason I don't entirely understand and cannot change even if I wanted to, writes that block of...

Fstreams C++

Hello I want the ofstream to write at the end of a file without erasing its content inside. how can i do it? (i'm talking about txt files,and C++) Thanks. ...

Java: Writing a DOM to an XML file (formatting issues)

I'm using org.w3c XML API to open an existing XML file. I'm removing some nodes , and I'm adding others instead . The problem is that the new nodes that are added are written one after another , with no newline and no indentation what so ever. While it's true that the XML file is valid , it is very hard for a human to examnine it. Is the...

What slows down growing database performance?

Hi all, I'm creating a database, and prototyping and benchmarking first. I am using H2, an open-source, commercially free, embeddable, relational, java database. I am not currently indexing on any column. After the database grew to about 5GB, its batch write speed doubled (the rate of writing was slowed 2x the original rate). I was ...

Ways to save enums in database

Hey guys. I am wondering what the best ways to save enums into a database is. I know there are name() and valueOf() methods to make it into a String back. But are there any other (flexible) options to store these values? Is there a smart way to make them into unique numbers (ordinal() is not safe to use)? Any comments and suggestions...

How do i write to the beginning of the file? C++

Hi, When I write to the beginning of the file,it always leaves the first line empty,and start writing from the second one. How can I make it write from the first line,including the first one and on? Thanks. ...

Techniques for writing critical text data

We take text/csv like data over long periods (~days) from costly experiments and so file corruption is to be avoided at all costs. Recently, a file was copied from the Explorer in XP whilst the experiment was in progress and the data was partially lost, presumably due to multiple access conflict. What are some good techniques to avoid...

Problem with print out to text file

Hello, I am completely stumped. I have a program that pulls information stored in a database, assigns the database values to a corresponding class. The class has a print method that prints the values of it's fields. The users type in either an order id or order date range and then it finds those orders and prints them out to a text file...

How can I read and manipulate CSV file data in C++?

Pretty self-explanatory, I tried google and got a lot of the dreaded expertsexchange, I searched here as well to no avail. An online tutorial or example would be best. Thanks guys. ...

Read and Write in Word file using Visual studio 2005

How to read and write a MS word file in VB.net or C# .net ...

Fast read/write from file in delphi

I am loading a file into a array in binary form this seems to take a while is there a better faster more efficent way to do this. i am using a similar method for writing back to the file. procedure openfile(fname:string); var myfile: file; filesizevalue,i:integer; begin assignfile(myfile,fname); filesizevalue:=GetFileSize(fn...

stdout thread-safe in C on Linux?

Is writing to stdout using printf thread-safe on Linux? What about using the lower-level write command? ...

Non blocking TCP write(2) succeds but the request is not sent

I am seeing that a small set of message written to a non-blocking TCP socket using write(2) are not seen on the source interface and also not received by the destination. What could be the problem? Is there any way that the application can detect this and retry? while (len > 0) { res = write (c->sock_fd, tcp_buf, len); if (re...

tcp - getting num bytes acked

In standard tcp implementations (say, on bsd), does anybody know if it's possible to find out how many bytes have been ack-ed by the remote host? Calling write() on a socket returns the number of bytes written, but I believe this actually means the number of bytes that could fit into the tcp buffer (not the number of bytes written to th...

python: problem using call.subprocess to use a file after writing it

In python I am trying to write a script that will edit text files and then run executables that use those text files. It basically entails 1)opening and reading/writing to a text file, and 2)using the file I just wrote in a bash command. Here is a simple example: import subprocess # write file a = ['1\n','2\n','3\n','4\n','5th and fi...

Playback large files on Windows Media Player during download

Hi, My question is about writing a video file to the hard drive that is being downloaded from the network and playing it at the same time using Windows Media Player. The file is pretty big and will take awhile to download. It is necessary to download it rather than just stream it directly to Windows Media Player. What happens is that, ...

How to Write Strings Into Binary File

With this code I tried to print the string "foo" 10 times in binary format. But why doesn't the function to do it work? #include <iostream> #include <fstream> using namespace std; template <typename T> void WriteStr2BinFh (string St, ostream &fn) { for (unsigned i = 0; i < St.size(); i++) { char CStr = St[i]; fn....

When does the write() system call write all of the requested buffer versus just doing a partial write?

If I am counting on my write() system call to write say e.g., 100 bytes, I always put that write() call in a loop that checks to see if the length that gets returned is what I expected to send and, if not, it bumps the buffer pointer and decreases the length by the amount that was written. So once again I just did this, but now that the...

How to compute accurately the time it takes a Java program to write or read a file ?

How to compute accurately the time it takes a Java program to write or read a number of bytes from/to a file ? It is really important that the time is being measured accurately. (The time should be computed by the program itself). ...

PHP write to file

Hi, below is some code I am using to "translate" a map array into SQL code so I can easily update my database when I have updated my game map. As you can see it prints out the SQL code onto the screen so I can copy and paste it. As my maps will get bigger this will become inefficient as it will crash the browser due to mass output, so i...