io

How to use C to write to flash drive bootsector despite error 'Failed to open file to write.:Permission Denied' ?

My goal is to manipulate the boot-sector in my flashdrive (volume E:) I am using XP. I am able to read the boot-sector FILE *fp_read = fopen("\\\\.\\E:", "rb"); /* Able to proceed to read boot sector */ however i am not able to open the file to write using fopen in 'wb' mode. FILE *fp_read = fopen("\\\\.\\E:", "wb"); /* Unable t...

Java BufferedReader readline blocking?

I want to make an HTTP request and then get the response as sketched here: URLConnection c = new URL("http://foo.com").openConnection(); c.setDoOutput(true); /* write an http request here using a new OutputStreamWriter(c.getOutputStream) */ BufferedReader reader = new BufferedReader(new InputStreamReader(c.getInputStream)); reader.rea...

Java: Efficiency of the readLine method of the BufferedReader and possible alternatives

We are working to reduce the latency and increase the performance of a process written in Java that consumes data (xml strings) from a socket via the readLine() method of the BufferedReader class. The data is delimited by the end of line separater (\n), and each line can be of a variable length (6KBits - 32KBits). Our code looks like: ...

Java: Difference between PrintStream and PrintWriter

What is the difference between PrintStream and PrintWriter? They have much methods in common. I always mix up this classes because of that reason. And I think we can use them for exactly the same. But there has to be a difference. Otherwise there was only one class. I first searched on StackOverflow, but not yet this question. ...

VB.Net IO performance

Having read this page, I can't believe that VB.Net has such a terrible performance when it comes to I/O. Is this still true today? How does the .Net Framework 2.0 perform in terms of I/O (that's the version I'm targeting)? ...

how retrieve the completely result from shell in Asynchronism process???

Hi all refer to these post : here1 and here2 at last I solve my problem by build a asynchronous solution,and it work well!!! but there is a problem that i face with it,now my code is like this: class MyProcessStarter { private Process process; private StreamWriter myStreamWriter; private static StringBuilder ...

Disk IO profiler for existing applications

I need to know what file a specific program read. (this specific program is based on .net). Is there a recommendation for a good profiler? ...

using htmlpurifier for input or output escaping/filtering

I am processing a user input from the public with a javascript WYSIWYG editor and I'm planning on using htmlpurifier to cleanse the text. I thought it would be enough to use htmlpurifier on the input, stored the cleaned input in the database,and then output it without further escaping/filtering. But I've heard other opinions that you s...

how to write a text file after the previous line in c#??

Dear all, My below code create a txt file and write something to that file.but i need to write new line after the previous lines when i run the script several times. code: string filePath = "D:\\DOT_NET\\C#\\abc.txt"; FileInfo t = new FileInfo(filePath); StreamWriter Tex = t.CreateText(); ...

Reading and writing in parallel

I want to be able to read and write a large file in parallel, or if not in parallel, at least in blocks so that I don't use up so much memory. This is my current code: // Define memory stream which will be used to hold encrypted data. MemoryStream memoryStream = new MemoryStream(); // Define cryptographic strea...

How to open a text file that's not in the same folder?

Since C it's not a language I am used to program with, I don't know how to do this. I have a project folder where I have all the .c and .h files and a conf folder under which there is a config.txt file to read. How can I open that? FILE* fp = fopen("/conf/config.txt", "r"); if (fp != NULL) { //do stuff } else printf("couldn't ...

How do I load a file from bin folder in ASP.NET in medium trust

I need to load an xML file from the bin folder in ASP.NET (MVC, not that it would count). I can't get the bin folder path nor load the file otherwise.. I need to feed the following method : using(var file = System.IO.File.OpenRead(/* something */)) { } ...

dealing with IO vs pure code in haskell

I'm writing a shell script (my 1st non-example in haskell) which is supposed to list a directory, get every file size, do some string manipulation (pure code) and then rename some files. I'm not sure what i'm doing wrong, so 2 questions: How should i arrange the code in such program? I have a specific issue, i get the following error, ...

How it is called when write or read return less that requested?

What term should I use to describe situations (or bugs in software) caused by read, write, send, recv doing less work than expected? For example, write(fd, "123456", 6); may return 3 and we need to write "456" to finish our work. /* Still in doubt between "short write/read" and "data truncation" after reading answers. */ ...

Handling of data truncation (short reads/writes) in FUSE

I expect any good program should do all their reads and writes in a loop until all data written/read without relying that write will write everything (even with regular files). Am I right? Implemented simple FUSE filesystem which only allows reading and writing with small buffers, very often returning that it is written less bytes that ...

java.io.StreamCorruptedException: invalid stream header: 7371007E

Hello, this is pprobably a simple question . I got a client Server application which communicate using objects. when I send only one object from the client to server all works well. when I attempt to send several objects one after another on the same stream I get StreamCorruptedException. can some one direct me to the cause of t...

Why is this c++ string concatenation missing a space?

I am working with c++ strings, and am a beginner at programming. I am expecting: 99 Red Balloons But I am receiving: 99 RedBalloons Why is that? #include <string> #include <iostream> using namespace std; int main() { string text = "9"; string term( "9 "); string info = "Toys"; string color; char hue[4] = {'R','e...

StreamCorruptedException, when using ObjectInputStream

Hi, I need to send an Object from client to server by serializing it. This is my code: HttpURLConnection con = null; ObjectOutputStream out = null; ObjectInputStream inputStream = null; URL servlet = new URL("MY_URL"); con = (HttpURLConnection) servlet.openConnection(); con.setDoInput(true); ...

Treating a file of Java floats as a lazy Clojure sequence.

Hi; What would be an ideomatic way in Clojure to get a lazy sequence over a file containing float values serialized from Java? (I've toyed with a with-open approach based on line-reading examples but cannot seem to connect the dots to process the stream as floats.) Thanks. ...

Can redirection of screen output to file change the result of a C++ code?

I am having this very weird behaviour with a C++ code: It gives me different results when running with and without redirecting the screen output to a file (reproducible in cygwin and linux). I mean, if I get the same executable and run it like ./run or run it like ./run >out.log, I get different results! I use std::cout to output to scr...