Hi,
I am trying to write a function that reads in individual lines from a txt file and stores them in a string array. The function works correctly except for when it reads in blank lines. Example:
Function
ifstream flinput( "somefile.txt" )
string line;
while( getline(flinput, line) ) {
//Add line to array
So the problem is if th...
My recent turn-on is using BinaryFormatter instead of some database product. I have an idea to write simple 64bit number into hardware dongle, and encrypt my files with it - via simple XOR operation. Just so it can't be readable at some other end. Do I derive from Stream, or what?
I know I can simply put that number into the file and...
I've been told that System.IO.MemoryStream need not be wrapped in a using block because there is no underlying resource, this kinda goes against what i've always been told about streams ("if in doubt, use a using").
Is this true? Why then does MSDN example use one (summarized below)?
using(MemoryStream memStream = new MemoryStream(100...
I have an HTTP Handler that is binding an XmlTextWriter instance to Response.Output like so...
Sub GenerateXml(ByRef Response As HttpWebResponse)
Using Writer As New XmlTextWriter(Response.Output)
' Build XML
End Using
End Sub
And now I also want the same XML to be saved to the local hard drive (in addition to being st...
I'm fetching a web page using the Apache httpcomponents Java library. After connecting the result I get is an HttpEntity which has a method getContent() which returns an InputStream and also has a method writeTo() which writes to an OutputStream.
I want to turn the result into a String for extracting information. What is the most elegan...
I have create my code in order to write images in a remote sql server
All the details of accessing and writing are fine until now, including the system account
right now i'm in the command of:
SqlFileStream = New SqlFileStream(filePathName, fileToken, FileAccess.Write)
and when i'm trying to execute it the Server returns the error 'A...
I've written a simple chat program to experiment with some basic tcp/socket concepts. For some reason I've found that when I close my writer stream (which I am getting from the TcpClient.GetStream() function) it will send one final null message to my server. To top it all off it doesn't do this if I send one final message over the stream...
I am trying to write a function which will accept an InputStream with Zip file data and would return another InputStream with unzipped data.
The Zip file will only contain a single file and thus there is no requirement of creating directories, etc.
I tried looking at ZipInputStream and others but I am confused by so many different type...
Hi,
I am trying upload multiple files using WCF. Since WCF only supports one stream I need to join multiple file streams together on the client and pass this to the service.
The files might be huge and cannot be buffered in memory.
How do I do this? Please show some code sample if you have.
Regards,
Rune
...
Hi,
I have a simple text file, that has following content
word1 word2
I need to read it's first line in my C++ application.
Following code works, ...
std::string result;
std::ifstream f( "file.txt" );
f >> result;
... but result variable will be equal to "word1". It should be equal to "word1 word2" (first line of text file)
Yes, i ...
I am trying to move from a mysql set to a postgres one, and one of the fields that I'm having trouble moving is a mysql LBLOB. I am trying to move it into a LargeObject type in postgres and I'm having some speed issues. I'm doing this in Java/Groovy and, frankly, the streaming business has me confused.
I've tried two approaches: Hold...
I'm trying to write a recursive function that does some formatting within a file I open for a class assignment. This is what I've written so far:
const char * const FILENAME = "test.rtf";
void OpenFile(const char *fileName, ifstream &inFile) {
inFile.open(FILENAME, ios_base::in);
if (!inFile.is_open()) {
cerr << "Could...
Hello,
I'm working with an ASCII input/output stream over a Socket and speed is critical. I've heard using the right Java technique really makes a difference. I have a textbook that says using Buffers is the best way, but also suggests chaining with DataInputStreamReader.
For output I'm using a BufferedOutputStream with OutputStreamWri...
Any ideas on how to discard or reset the contents in a Process.StandardOutput, so we can discard the message of the day and any other initial content of a process?
...
I'm trying to implement my own QDebug() style debug-output stream, this is basically what I have so far:
struct debug
{
#if defined(DEBUG)
template<typename T>
std::ostream& operator<<(T const& a) const
{
std::cout << a;
return std::cout;
}
#else
template<typename T>
debug const& operator<<(T cons...
I have been coding Java for a while, but I have to admit that I don't get streams, buffers, etc. 100%
I have tried to find a good tutorial on the subject that explains the reasoning behind them and their patterns of usage, but I couldn't find any. Only short, isolated snippets that don't help.
Is there something out there?
...
First of all, I love ASP.NET MVC. This question is not a criticism of it. Rather, I want to confirm what I think I see and make sure I haven't missed something. Bear with me ... I can't get to the question without providing a little bit of context.
The question has to do with returning data in a Stream in response to an HTTP Post. In th...
I am creating an IronPython engine more or less like so:
var engine = IronPython.Hosting.Python.CreateEngine();
var scope = engine.CreateScope();
// my implementation of System.IO.Stream
var stream = new ScriptOutputStream(engine);
engine.Runtime.IO.SetOutput(stream, Encoding.UTF8);
engine.Runtime.IO.SetErrorOutput(stre...
Note: Edited based on responses to receive more appropriate answers.
I have a collection of C++ templates that I've made over the years, which I call Joop. It comprises mainly libraries that don't quite fall into the "general-purpose" category but are just useful enough that I keep slapping them into different projects, so most of them ...
I want to download thousands of files from the web and save them locally. What is the most efficient way? It is important the failures timeout within 10 seconds.
Is there a better way to stream one stream into another? Maybe a smaller buffer, like 1024 bytes at a time, is more efficient for large files?
Dim w_req As System.Net.HttpW...