Click here to Skip to main content
15,922,630 members
Home / Discussions / C#
   

C#

 
AnswerRe: Printing Bytes to printer in MVC Pin
Kornfeld Eliyahu Peter8-Jul-14 1:20
professionalKornfeld Eliyahu Peter8-Jul-14 1:20 
AnswerRe: Printing Bytes to printer in MVC Pin
Richard MacCutchan8-Jul-14 1:14
mveRichard MacCutchan8-Jul-14 1:14 
GeneralRe: Printing Bytes to printer in MVC Pin
nitin_ion8-Jul-14 1:16
nitin_ion8-Jul-14 1:16 
GeneralRe: Printing Bytes to printer in MVC Pin
Pete O'Hanlon8-Jul-14 1:33
mvePete O'Hanlon8-Jul-14 1:33 
AnswerRe: Printing Bytes to printer in MVC Pin
Dave Kreskowiak8-Jul-14 5:06
mveDave Kreskowiak8-Jul-14 5:06 
QuestionWindows services Not starting with c# codes Pin
Chinedu Nwankwo7-Jul-14 21:04
Chinedu Nwankwo7-Jul-14 21:04 
SuggestionRe: Windows services Not starting with c# codes Pin
Richard Deeming8-Jul-14 1:40
mveRichard Deeming8-Jul-14 1:40 
QuestionSession Timeout Pin
Member 106416987-Jul-14 19:57
Member 106416987-Jul-14 19:57 
AnswerRe: Session Timeout Pin
Bernhard Hiller7-Jul-14 20:46
Bernhard Hiller7-Jul-14 20:46 
AnswerRe: Session Timeout Pin
Karen Mitchelle7-Jul-14 20:55
professionalKaren Mitchelle7-Jul-14 20:55 
GeneralRe: Session Timeout Pin
Richard MacCutchan7-Jul-14 22:22
mveRichard MacCutchan7-Jul-14 22:22 
AnswerRe: Session Timeout Pin
Richard MacCutchan7-Jul-14 22:23
mveRichard MacCutchan7-Jul-14 22:23 
SuggestionRe: Session Timeout Pin
ZurdoDev9-Jul-14 2:19
professionalZurdoDev9-Jul-14 2:19 
QuestionTexbox OnKeyPress event thru javascript executes a button click event Pin
bjay tiamsic7-Jul-14 15:37
bjay tiamsic7-Jul-14 15:37 
AnswerRe: Texbox OnKeyPress event thru javascript executes a button click event Pin
Dave Kreskowiak7-Jul-14 17:46
mveDave Kreskowiak7-Jul-14 17:46 
QuestionAn MVC concern Pin
Neo101017-Jul-14 10:25
Neo101017-Jul-14 10:25 
QuestionRe: An MVC concern Pin
Richard Deeming7-Jul-14 11:33
mveRichard Deeming7-Jul-14 11:33 
AnswerRe: An MVC concern Pin
Neo101017-Jul-14 22:33
Neo101017-Jul-14 22:33 
AnswerRe: An MVC concern Pin
Richard MacCutchan7-Jul-14 22:21
mveRichard MacCutchan7-Jul-14 22:21 
QuestionHow to make Setup Project Pin
Amr Muhammed7-Jul-14 8:32
Amr Muhammed7-Jul-14 8:32 
AnswerRe: How to make Setup Project Pin
OriginalGriff7-Jul-14 8:58
mveOriginalGriff7-Jul-14 8:58 
GeneralRe: How to make Setup Project Pin
Amr Muhammed7-Jul-14 11:30
Amr Muhammed7-Jul-14 11:30 
GeneralRe: How to make Setup Project Pin
OriginalGriff7-Jul-14 22:25
mveOriginalGriff7-Jul-14 22:25 
SuggestionRe: How to make Setup Project Pin
Erik Rude14-Jul-14 5:03
Erik Rude14-Jul-14 5:03 
QuestionBuffered Stream & OpenRead Pin
computerpublic7-Jul-14 7:54
computerpublic7-Jul-14 7:54 
C#
<pre>/*
Hello friends, I am trying to show my students that a computer program is an arrangement of numbers. My kids love only video games and sports, but not every child is going to go on to play and make a living in sports. I am trying to get them interested in something other than sports. I am trying to engage then in something that they like that is more practical for them in the long run. I am not a computer programmer, but I know the importance of it. What you see here is what I have learn and read in books, but it is not working. I have tried many times to gain help in fixing this code, but no one in the forum wanted to help. They only wanted to make comments to show there arrogance. I have deleted some of it in order to make it short and simple. I can do some basic things, but now its getting very complicated. All i am attempting to do is read a file piece by piece, turn each byte into a number and SHOW IT, turn the number back to a byte and SHOW IT, then reassemble back the file and save it to another location the computer. That's all the kids want to see.
*/ 
using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Applica
{
    class Program
    {
        static void Main(string[] args)
        {
            DirectoryInfo da = new DirectoryInfo("C:\\Folder1");
            FileInfo[] Arr = da.GetFiles();
            FileInfo ap = Arr[Arr.Length - 1];
            long Totbyte = ap.Length;
            string filePath = ap.FullName;
            Console.WriteLine("Total Bytes = {0} bytes", Totbyte);
            string temPath = Path.GetTempFileName();
            string temPath2 = Path.GetTempFileName();
            const int BufferSize = 1024;
            byte[] buffer = new byte[BufferSize];

            using (BufferedStream input = new BufferedStream(File.OpenRead(temPath)))
            {
                int bytesRead;
                using (BufferedStream output = new BufferedStream(File.OpenWrite(temPath2)))
                {
                    while ((bytesRead = input.Read(buffer, 0, BufferSize)) > 0)
                    {
                        // Convert the bytes to decimals:
                        decimal[] arry = new decimal[Totbyte];
                        for (int count = 0; count < buffer.Length; count++)
                        {
                            arry[count] = buffer[count];
                            Console.WriteLine("{0}={1}",arry[count],buffer[count]);//THE VISUAL PRESENTATION DOES NOT WORK
                        }
                        // Convert the decimals back to bytes:
                        byte[] data2 = new byte[Totbyte];
                        for (int count = 0; count < arry.Length; count++)
                        {
                            data2[count] = (byte)arry[count];
                            Console.WriteLine("{0}={1}",data2[count],arry[count]);//THE VISUAL PRESENTATION DOES NOT WORK
                        }
                        string filePath2 = Path.Combine("C:\\check", Path.GetFileName(filePath));//THE OUTPUT FILE DOES NOT WORK
                        output.Write(buffer, 0, bytesRead);
                    }
                }
            }
        }
    }
} 



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.