Click here to Skip to main content
15,567,221 members
Home / Discussions / C#
   

C#

 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 9:24
computerpublic7-Jul-14 9:24 
GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 9:56
mvaOriginalGriff7-Jul-14 9:56 
JokeRe: Buffered Stream & OpenRead Pin
Wes Aday7-Jul-14 11:58
professionalWes Aday7-Jul-14 11:58 
GeneralRe: Buffered Stream & OpenRead Pin
Pete O'Hanlon7-Jul-14 12:22
mvaPete O'Hanlon7-Jul-14 12:22 
GeneralRe: Buffered Stream & OpenRead Pin
Wes Aday7-Jul-14 12:35
professionalWes Aday7-Jul-14 12:35 
GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 23:20
mvaOriginalGriff7-Jul-14 23:20 
GeneralRe: Buffered Stream & OpenRead Pin
Pete O'Hanlon8-Jul-14 0:28
mvaPete O'Hanlon8-Jul-14 0:28 
AnswerRe: Buffered Stream & OpenRead Pin
Eddy Vluggen7-Jul-14 9:46
professionalEddy Vluggen7-Jul-14 9:46 
computerpublic wrote:
All i am attempting to do is read a file piece by piece, turn each byte into a number
You're assuming a text-file in ASCII? In UTF, a charactar might consist of multiple bytes.
C#
static void Main(string[] args)
{
    string data;
    using (var fs = new FileStream(path: @"D:\Projects\ConsoleApplication6\ConsoleApplication6\Program.cs", mode: FileMode.Open))
    using (var rdr = new StreamReader(fs))
    {
        data = rdr.ReadToEnd();
    }

    using (var fsout = new FileStream(path: "output.txt", mode: FileMode.Create))
    foreach (char c in data)
    {
        Byte b = ASCIIEncoding.ASCII.GetBytes(new char[] { c })[0];
        Console.WriteLine("{0} {1}", c, b);
        fsout.WriteByte(b);
    }

    Console.WriteLine();
    Console.WriteLine(File.ReadAllText("output.txt"));

    Console.ReadLine();
}
Put the cursor on the first line and press the F9. Next use F10 to step thorugh all the instructions.

Soooo, to bring the subject back to my fee.. Suspicious | :suss:
Bastard Programmer from Hell Suspicious | :suss:
If you can't read my code, try converting it here[^]

GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 9:52
mvaOriginalGriff7-Jul-14 9:52 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 10:12
computerpublic7-Jul-14 10:12 
GeneralRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 10:19
mveRichard Deeming7-Jul-14 10:19 
GeneralRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 10:23
professionalKornfeld Eliyahu Peter7-Jul-14 10:23 
JokeRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 10:27
mveRichard Deeming7-Jul-14 10:27 
GeneralRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 10:31
professionalKornfeld Eliyahu Peter7-Jul-14 10:31 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 10:29
computerpublic7-Jul-14 10:29 
GeneralRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 10:39
mveRichard Deeming7-Jul-14 10:39 
GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 10:35
mvaOriginalGriff7-Jul-14 10:35 
GeneralRe: Buffered Stream & OpenRead Pin
Eddy Vluggen7-Jul-14 11:32
professionalEddy Vluggen7-Jul-14 11:32 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 10:00
computerpublic7-Jul-14 10:00 
AnswerRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 10:08
mveRichard Deeming7-Jul-14 10:08 
AnswerRe: Buffered Stream & OpenRead Pin
Paulo Zemek7-Jul-14 12:18
Paulo Zemek7-Jul-14 12:18 
QuestionPop up error message when I call AS400 Stored Procedures via c# application Pin
JanakaND7-Jul-14 1:43
JanakaND7-Jul-14 1:43 
AnswerRe: Pop up error message when I call AS400 Stored Procedures via c# application Pin
Pete O'Hanlon7-Jul-14 1:52
mvaPete O'Hanlon7-Jul-14 1:52 
GeneralRe: Pop up error message when I call AS400 Stored Procedures via c# application Pin
JanakaND7-Jul-14 2:11
JanakaND7-Jul-14 2:11 
AnswerRe: Pop up error message when I call AS400 Stored Procedures via c# application Pin
Kornfeld Eliyahu Peter7-Jul-14 2:36
professionalKornfeld Eliyahu Peter7-Jul-14 2:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.