streams

std::copy problem when reading matrix from file

I dont know why the entire matrix gets stored in the first row itself. The loop does actually get called N times if there are N rows. and this is matrix.dat 5 1 2 3 1 2 0 100 3 4 0 5 6 -1 0 9 10 11 #include <fstream> #include <iterator> #include <vector> #include <iostream> int main() { std::vector<std::vector<int> > matrix; ...

Not sure why my reader won't read my text file

I have the following code to read a file in the root directory of my application. For some reason, no matter how many runs, my file is still not being read. Any idea what I could be doing wrong here please. Thanks in advance. byte[] mybytes = null; if (File.Exists(filename)) { using (StreamReader sr = new StreamReader(new FileStream...

How to use std::wstring with std::istringstream?

I am trying to write a template function which will extract the value of the given datatype from the given string. I came up with something like this: template<class T> static T getValue(const CString& val_in) { std::wstring value = val_in; std::istringstream iss; iss.str(value); T val = T(); iss>>va...

Is there a way to dump a stream from the debugger in VS

I'm using VS 2010 and am working with a lot of streams in C# in my current project. I've written some stream dump utilities for writing out certain types of streams for debugging purposes, but I seem to keep stumbling across times when I am debugging and need to look into the stream I am debugging over, but I didn't put my dump calls in ...

NTFS alternate data streams

Today I have seen this weird magic NTFS system supports: each file can have multiple data streams. Basically one could have a file a.txt of 0b size but there can be any number of bytes hidden in a separate data stream for that file. This is strictly NTFS related magic and I don't see any noble reason for having these streams around. You ...

Possible to sit on the network and receive a TCP stream/UDP datagrams?

Has anyone out there done the work of sitting on top of a packet capture interface (like jpcap) with an implementation of UDPSocket (for UDP datagrams) and InputStream (for TCP streams)? I suppose it wouldn't be too hard to do given the callback API in jpcap, but has anyone out there already done it? Are there any issues with doing this...

Classic ASP on IIS7: ADODB.Stream error File could not be opened - accessing outside the webroot

I've just reinstalled a server, it is a new machine, same OS verion (Win2008) and same IIS version (7.0). The app was working perfectly (and then the machine blew up). I'm getting this error when I try to access a file outside the webroot: ADODB.Stream error '800a0bba' File could not be opened I can access it fine using FileSystemObje...

C# List<Stream> dispose/close

I am setting up a subscription service to send reports to various people in our company on a schedule. I plan to email the reports, the reporting system I am using is able to export as PDF stream (rather than writing temp files). Most people will receive more than one report so I am trying to attach them all to one email doing something ...

Getting the cURL stream in PHP

Hello, 1/ If I run curl_exec with no options, the fetched page gets output on php's standard output (the html page being served back). 2/ If I run it with the RETURNTRANSFER option set, I can get the whole page in a variable. How can I get a stream, that I can then manually parse? In case 1/ I cannot access the data to parse it and in...

Network protocol object serialization in C++

Hello, I'm writing some C++ code that will have to send data over TCP/IP. I want this code to be portable on Linux/Windows/Osx. Now, as it is the first time I write portable network code, I basically need some simple functions to add to certain objects like: class myclass{ ...member... public: string serialize(){ std::ostringst...

putting a stream in the clipboard

Lets begin with the final goal - I need to able to paste a file into the local file system, that is obtained from a web response stream. I think that the best course of action is to somehow put something inside the clipboard that will notify me when the pasting action occurs, so I can then run the async request, wait for the response, a...

Why is it more memory efficient to read input as stream vs. string?

We're using HTTPClient to implement a REST API. We're reading the server response using: method = new PostMethod(url); HttpClient client = new HttpClient(); int statusCode = client.executeMethod(method); String responseBody = method.getResponseBodyAsString(); When we do this we get this warning: Dec 9, 2009 7:41:11 PM org.apache.com...

How to change endianness when unmarshalling a CDR stream containing valuetype objects in Java.

I've got marshaled CDR data all by itself in the form of a file (i.e., not packed in a GIOP message) which I need to unmarshal and display on the screen. I get to know what type the data is and have working code to do this successfully by the following: ValueFactory myFactory = (ValueFactory)myConstructor.newInstance( objParam ); Stream...

Best approach to serialize XML to stream with Java?

We serialize/deserialize XML using XStream... and just got an OutOfMemory exception. Firstly I don't understand why we're getting the error as we have 500MB allocated to the server. Question is - what changes should we make to stay out of trouble? We want to ensure this implementation scales. Currently we have ~60K objects, ea...

Fixed-size character encoding

Hello world ! I am developing, in VB.Net, an application that reads from text files using a FileStream Object. I do not use a StreamReader, since the buffering it does makes it impossible to use Seek. Those text files form a database, with both index and data files. In index files, all fields are fixed-length, which is not the case in ...

Need Good C++ Libraries For Strings & HTTP Streams

Hi, I'll soon be starting a project of mine that heavily involves reading and interacting with websites. So I'd like to start pulling in some decent libraries to cut down on some of the dirty work that needs to be done in C++. Thus far I've found 'The Better String Library' for string manipulation. Any other suggestions? ...

negative precision values in ostream

This is more of a question of curiosity but does anyone know how negative precision values are handled in C++? For example: double pi = 3.14159265; cout.precision(-10); cout.setf(ios::fixed, ios::floatfield); cout << pi << endl; I've tried this out and using GCC and it seems that the precision value is ignored but I was curious if ...

Edit a specific Line of a Text File in C#

Hi everybody I have two text files, Source.txt and Target.txt, the source will never be modified and contain N lines of text. So, I want to delete an specific line of text in Target.txt, and replace by an specific line of text from Source.txt, I know what number of line I need, actually is the line number 2, both files. I haven somethi...

Metadata and multiple - interleaved, insertable - streams: which file format?

Once I think about new software projects and current-age data uses, I cannot stand raw files anymore. they seem unnatural now. Basically a file should contain one or more data "streams", metadata/attributes, etc. The file should be optimized for sequential, parallel read (like mkv I think) but have reasonable performance for direct ("r...

Processing large XML file with libxml-ruby chunk by chunk

I'd like to read a large XML file that contains over a million small bibliographic records (like <article>...</article>) using libxml in Ruby. I have tried the Reader class in combination with the expand method to read record by record but I am not sure this is the right approach since my code eats up memory. Hence, I'm looking for a rec...