I need the program to give the output of the batch script, and at the moment it's just printing
System.IO.StreamReader
and it should be printing whatever the batch script says
This is only the part that has to do with starting a new process, the variables like the path to the file are declared and the script itself runs but doesn't s...
I have a BufferedReader looping through a file. When I hit a specific case, I would like to continue looping using a different instance of the reader but starting at this point.
Any ideas for a recommended solution? Create a separate reader, use the mark function, etc.?
...
If I use a FileStream to create a StreamReader, will the StreamReader close when I close the FileStream or will I need to close the StreamReader too?
public void ReadFile()
{
var file = new FileStream("c:\file.txt", FileMode.Open, FileAccess.Read);
var reader = new StreamReader(file);
try
{
txtFile.Text = reader.Re...
Hi,
I want to import records from csv file to the DB from Silverlight front end. I am using WCF service to perform the DB operations. When I pass the entire file path (hard coded), I am able to add records to the DB, but as OpenFileDialog in Silverlight doesn't allow to obtain the file path's (due to security reasons), I tried using WCF...
I have a text file named C:/test.txt:
1 2 3 4
5 6
I want to read every number in this file using StreamReader.
How can I do that?
...
Im trying to convert a byte array to a string. The byte array includes a preamble (if the used encoder had one of those), and you must specify the default encoding if no preamble is stored in the byte array.
My code looks like this
public static string ArrayToStringUsingPreambleOrDefaultEncoder(byte[] bytes, Encoding defaultEncoder, o...
Hello,
I need to implement a search engine. So I have a dictionary which is a hash table and it consists words. Also I have some texts, I need to go over all the texts and put into the posting file the text number and the place of each word in the texts.
So each time I have an occurrence of some word and that word already exists in the...
Hello,
I have a program where I am using windows form, in that form I use openFileDialog where I open a file in some directory. Then I use in a different function a StreamReader and I have a 2nd file in my big/debug directory which I want the streamReader to open. But for some reason after I open the 1st file with the openFileDialog the...
I am having difficulty redirecting the output from a console application to a Windows Form App, when the process is created in a separate *.dll file (excuse the sloppy terminology, but I'm new to programming). I came across this link (and I may pursue his method), detailing a similar problem: http://www.codeproject.com/KB/threads/launchp...
Hello I am working on something, and I need to be able to be able to add text into a .txt file. Although I have this completed I have a small problem. I need to write the string in the middle of the file more or less. Example:
Hello my name is Brandon,
I hope someone can help, //I want the string under this line.
Thank you.
Hopefully ...
Basically I need someone to help me or show me the code that will allow me to read a name and a price from a file i have called c1.txt.
This is what i already have.
TextReader c1 = new StreamReader("c1.txt");
if (cse == "c1")
{
string compc1;
compc1 = c1.ReadLine();
Console.WriteL...
Hi,
I am trying to figure out how to pass a class/struct/etc.. using named pipe between thread(I am trying to measure some performance using the stopwatch and compare it to other methods..)
Anyway , All the documention I've found is talking about using StreamReader and readline to get the data from the NamedPipeServerStream. However re...
So, I'm playing around with getting the HTML out of a standard ASP.Net Page. I've overridden the Render method, as so:
protected override void Render(HtmlTextWriter writer)
{
MemoryStream memoryStream = new MemoryStream();
try
{
using (StreamWriter streamWriter = new StreamWriter(memoryStream))
{
...
I am calling a RESTful web service in the back-end of some ASP.NET pages.
I am using ASP.NET asynchronous pages, so under the hood I am using the methods:
HttpWebRequest BeginGetResponse()
and
HttpWebRequest EndGetResponse()
The response string in my case is always a JSON string. I use the following code to read the entire s...
I'm in the process of creating a custom stream for an API endpoint in my app. The stream needs to have custom logic that I don't want to get into, but suffice to say I can't use a built-in stream class.
I did the minimum necessary to implement a read-only stream (inheriting from System.IO.Stream) and I've verified that the System.IO.Bin...
I have an application that is localized for use across Europe.
I have a menu option that loads a file from disk.
This operation works fine on my dev machine but does not work on the virtual machine I use to test other operating systems _ e.g French, Spanish etc.
A FileNotFoundException is generated when the StreamReader tries to open...
Hello again,
I've got the lovely task of working out how to handle large files being loaded into our application's script editor (its like VBA for our internal product for quick macros). Most files are about 300-400Kb which is fine loading. But when they go beyond 100Mb the process has a hard time as you'd expect.
What happens is that ...
Hi, this is probably not that hard to do.
But I've got two text files. The first has got a list of certain keywords.
Each one if these keywords are fed into a combobox.
Now, when I choose one of the items from this combobox, I want to search the other textfile for the same keyword and read from that point to the next keyword. And the...
Hi
I would like to unit test the following method
public IEnumerable<T> GetData<T>(StreamReader fileStream) where T : new()
The streamreader needs to be a file in CSV format, with particular column names.
Is it possible to create such files in code, rather than having to have lots of them on the file system for each unit test?
Any ...
How to take a stringbuilder and convert it to a stream?
SO my stringbuilder has to be converted into a :
StreamReader stream = ????
Update
I tried using a stringreader like:
StringReader sr = new StringReader(sb.ToString());
StreamReader stream = new StreamReader(sr);
but that doesn't work?
...