Click here to Skip to main content
15,881,803 members
Home / Discussions / C#
   

C#

 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 8:24
computerpublic7-Jul-14 8:24 
GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 8:56
mveOriginalGriff7-Jul-14 8:56 
JokeRe: Buffered Stream & OpenRead Pin
Wes Aday7-Jul-14 10:58
professionalWes Aday7-Jul-14 10:58 
GeneralRe: Buffered Stream & OpenRead Pin
Pete O'Hanlon7-Jul-14 11:22
mvePete O'Hanlon7-Jul-14 11:22 
GeneralRe: Buffered Stream & OpenRead Pin
Wes Aday7-Jul-14 11:35
professionalWes Aday7-Jul-14 11:35 
GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 22:20
mveOriginalGriff7-Jul-14 22:20 
GeneralRe: Buffered Stream & OpenRead Pin
Pete O'Hanlon7-Jul-14 23:28
mvePete O'Hanlon7-Jul-14 23:28 
AnswerRe: Buffered Stream & OpenRead Pin
Eddy Vluggen7-Jul-14 8:46
professionalEddy Vluggen7-Jul-14 8: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 8:52
mveOriginalGriff7-Jul-14 8:52 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 9:12
computerpublic7-Jul-14 9:12 
GeneralRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 9:19
mveRichard Deeming7-Jul-14 9:19 
GeneralRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 9:23
professionalKornfeld Eliyahu Peter7-Jul-14 9:23 
JokeRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 9:27
mveRichard Deeming7-Jul-14 9:27 
GeneralRe: Buffered Stream & OpenRead Pin
Kornfeld Eliyahu Peter7-Jul-14 9:31
professionalKornfeld Eliyahu Peter7-Jul-14 9:31 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 9:29
computerpublic7-Jul-14 9:29 
GeneralRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 9:39
mveRichard Deeming7-Jul-14 9:39 
GeneralRe: Buffered Stream & OpenRead Pin
OriginalGriff7-Jul-14 9:35
mveOriginalGriff7-Jul-14 9:35 
GeneralRe: Buffered Stream & OpenRead Pin
Eddy Vluggen7-Jul-14 10:32
professionalEddy Vluggen7-Jul-14 10:32 
GeneralRe: Buffered Stream & OpenRead Pin
computerpublic7-Jul-14 9:00
computerpublic7-Jul-14 9:00 
AnswerRe: Buffered Stream & OpenRead Pin
Richard Deeming7-Jul-14 9:08
mveRichard Deeming7-Jul-14 9:08 
AnswerRe: Buffered Stream & OpenRead Pin
Paulo Zemek7-Jul-14 11:18
mvaPaulo Zemek7-Jul-14 11:18 
QuestionPop up error message when I call AS400 Stored Procedures via c# application Pin
JanakaND7-Jul-14 0:43
JanakaND7-Jul-14 0:43 
AnswerRe: Pop up error message when I call AS400 Stored Procedures via c# application Pin
Pete O'Hanlon7-Jul-14 0:52
mvePete O'Hanlon7-Jul-14 0:52 
GeneralRe: Pop up error message when I call AS400 Stored Procedures via c# application Pin
JanakaND7-Jul-14 1:11
JanakaND7-Jul-14 1:11 
AnswerRe: Pop up error message when I call AS400 Stored Procedures via c# application Pin
Kornfeld Eliyahu Peter7-Jul-14 1:36
professionalKornfeld Eliyahu Peter7-Jul-14 1: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.