Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Buffered Stream & OpenRead

Buffered Stream & OpenRead

Scheduled Pinned Locked Moved C#
csharplinqhelp
29 Posts 7 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Richard DeemingR Richard Deeming

    OK, let me change that to: "We're generally a friendly bunch of geeks and nerds, apart from that Kornfeld Eliyahu Peter, who's a nasty scary man who should be avoided at all costs!" ;P


    "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu PeterK Offline
    Kornfeld Eliyahu Peter
    wrote on last edited by
    #20

    Thank you. I demand accuracy!

    I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)

    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

    1 Reply Last reply
    0
    • C computerpublic

      I am sorry I approach you the wrong way. I didn't the code project forum was about charging individual for help. After all it is a "forum". The country is quickly becoming second class because those who know do not want help those who do not know. Our jails and prison are full to capacity and prisoners in California are being release prematurely to make room for new prisoners. Think about education the next you see someone getting robs or violated. It could be you, your neighbor or your love ones. Its because of education or lack of education why our prison system is overwhelmed. You disgrace the forum when you make comments about being paid. You tarnish the reputation of the people who genuinely join the forum to help others. You can insult me and be as rude as you want. At least I am trying to help these kids to be interested in something. Have a good day Sir.

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #21

      We aren't about charging people for help; but we also aren't about doing other people's work for them; that doesn't help anyone in the long term. And in the case of teachers, it doesn't help anyone in the short term either. All it does is set you up for a fall - and a big one - when one of the students needs similar help and you can't provide it because you don't understand it yourself. At that point you lose the the whole class. They lose respect for your knowledge in this subject, and at that age probably respect for your knowledge in any subject. Then how will they learn? Go out, or use CraigsList - not to get this fixed, but to find someone who knows how to do it, and who'd willing to give up a couple of hours a week to pass that on, with your help as a profession, trained teacher (because people who are technically talented are usually about as good at teaching what the know as a dead monkey...)

      Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • C computerpublic

        I am a proud American and I try to instill the same values in the students. America use to be #1 in everything. Where are we now? I guess we are too busy making jokes. This is the CodeProject, not Comedy Central. Some of the users are going away from the core values of the CodeProject stand for. The jokes are not appreciated by me or my students. Mr. Deeming, thank you for your solution. I have not tried it yet, but looks like very professional. Thank you.

        Richard DeemingR Offline
        Richard DeemingR Offline
        Richard Deeming
        wrote on last edited by
        #22

        computerpublic wrote:

        I guess we are too busy making jokes.

        Well, Eddy's from the Netherlands, Griff's from Wales, and I'm from England, so I don't think we can blame the Americans for that. :)


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

        1 Reply Last reply
        0
        • C computerpublic

          I am sorry I approach you the wrong way. I didn't the code project forum was about charging individual for help. After all it is a "forum". The country is quickly becoming second class because those who know do not want help those who do not know. Our jails and prison are full to capacity and prisoners in California are being release prematurely to make room for new prisoners. Think about education the next you see someone getting robs or violated. It could be you, your neighbor or your love ones. Its because of education or lack of education why our prison system is overwhelmed. You disgrace the forum when you make comments about being paid. You tarnish the reputation of the people who genuinely join the forum to help others. You can insult me and be as rude as you want. At least I am trying to help these kids to be interested in something. Have a good day Sir.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #23

          computerpublic wrote:

          I am sorry I approach you the wrong way

          Ditto.

          computerpublic wrote:

          I didn't the code project forum was about charging individual for help.

          They don't!! :omg: That's why I also posted a possible solution, as opposed to haggling you into some agreement. Eveything that's posted becomes a bit of public property. And of the hamsters. Bottom point is, one can't ask money for what's already given.

          computerpublic wrote:

          You disgrace the forum

          From time to time, yes.

          computerpublic wrote:

          people who genuinely join the forum to help others

          The forum is free. It's all simply people talking about their work, sharing bits here and there, helping each other. That's how I learned this stuff, and that's why I'm helping others with their stuff here :)

          Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^]

          1 Reply Last reply
          0
          • OriginalGriffO OriginalGriff

            Is the education system in the USA really so rubbish that they let teachers who know nothing about complicated technical subjects teach it to people who probably know more about how to use the technology than the teachers? If so, then I'd fear for the future of your country, because that is like getting someone who can't drive to teach airline pilots to fly... :sigh:

            Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #24

            OriginalGriff wrote:

            education system in the USA really so rubbish

            Nope. I r a produck of da puplick edukashun sistum and I terned out just fine. :laugh: I would suspect that there is much more to this story than meets the eye.

            1 Reply Last reply
            0
            • C computerpublic

              /*
              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\[
              
              P Offline
              P Offline
              Paulo Zemek
              wrote on last edited by
              #25

              The bytesRead may differ from the BufferSize. So, you should do the for from 0 to less than bytesRead (you are doing the for to less than buffer.Length). You should use an ASCII text file for this to work, as other formats may use more than one byte per character. You don't need that Totbyte variable... you should always use the bytesRead instead.

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Is the education system in the USA really so rubbish that they let teachers who know nothing about complicated technical subjects teach it to people who probably know more about how to use the technology than the teachers? If so, then I'd fear for the future of your country, because that is like getting someone who can't drive to teach airline pilots to fly... :sigh:

                Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                P Offline
                P Offline
                Pete OHanlon
                wrote on last edited by
                #26

                I've gone back through the postings of this particular poster. This[^] makes for an ironic posting.

                L OriginalGriffO 2 Replies Last reply
                0
                • P Pete OHanlon

                  I've gone back through the postings of this particular poster. This[^] makes for an ironic posting.

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #27

                  Pete O'Hanlon wrote:

                  ironic posting

                  Precisely.

                  1 Reply Last reply
                  0
                  • P Pete OHanlon

                    I've gone back through the postings of this particular poster. This[^] makes for an ironic posting.

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #28

                    Wow! They get rapid advancement in the US don't they? Student to teacher in a few short months...

                    Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    1 Reply Last reply
                    0
                    • C computerpublic

                      Hey guys, thanks you very much. I will try to find someone on Craigslist who can do this for a small fee. Again, thank you very much.

                      P Offline
                      P Offline
                      Pete OHanlon
                      wrote on last edited by
                      #29

                      You're meant to be teaching this course. What happens when a student asks you a question about something that is, after all, incredibly simple? Do you wait until the following week to give an answer, the same way that you whinged about a previous lecturer of yours? If you can't write this stuff, you shouldn't be teaching it.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups