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 / C++ / MFC
  4. Counting characters in a buffer

Counting characters in a buffer

Scheduled Pinned Locked Moved C / C++ / MFC
c++
4 Posts 3 Posters 0 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.
  • O Offline
    O Offline
    Overfiend
    wrote on last edited by
    #1

    Ok im trying to count the characters that i have loaded into a buffer i have set up the following function void countchars(char *buffer, int *count) /*Counts the number of characters in the text file */ { int i,counter; char cdata; count['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; do { { for(cdata='A';cdata<='Z';cdata++) if(buffer[i]==counter[count]) { count++; } i++; } }while(buffer[i]!=EOF); } I am calling this function using the following code: countchars(buffer,cdata); printf("\nDistribution of letters in %s is:",fname); for (c='A';c<='Z';c++) { N=cdata[c]+cdata[tolower(c)]; printf("\n'%c' %4d: ",c,N); for (i=0;i

    R 1 Reply Last reply
    0
    • O Overfiend

      Ok im trying to count the characters that i have loaded into a buffer i have set up the following function void countchars(char *buffer, int *count) /*Counts the number of characters in the text file */ { int i,counter; char cdata; count['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']; do { { for(cdata='A';cdata<='Z';cdata++) if(buffer[i]==counter[count]) { count++; } i++; } }while(buffer[i]!=EOF); } I am calling this function using the following code: countchars(buffer,cdata); printf("\nDistribution of letters in %s is:",fname); for (c='A';c<='Z';c++) { N=cdata[c]+cdata[tolower(c)]; printf("\n'%c' %4d: ",c,N); for (i=0;i

      R Offline
      R Offline
      rrrado
      wrote on last edited by
      #2

      what a messy code


      rrrado

      Y 1 Reply Last reply
      0
      • R rrrado

        what a messy code


        rrrado

        Y Offline
        Y Offline
        yaname
        wrote on last edited by
        #3

        :laugh: Do your own homework, Overfiend. Member since Wednesday 9th April, 2003 8:32 10 Apr '03 Counting characters in a buffer - Overfiend Visual C++ (Programming Forums) 6:31 10 Apr '03 Counting characters in a buffer - Overfiend C# (Programming Forums) 10:42 9 Apr '03 Counting characters from a text file - Overfiend Visual C++ (Programming Forums)

        O 1 Reply Last reply
        0
        • Y yaname

          :laugh: Do your own homework, Overfiend. Member since Wednesday 9th April, 2003 8:32 10 Apr '03 Counting characters in a buffer - Overfiend Visual C++ (Programming Forums) 6:31 10 Apr '03 Counting characters in a buffer - Overfiend C# (Programming Forums) 10:42 9 Apr '03 Counting characters from a text file - Overfiend Visual C++ (Programming Forums)

          O Offline
          O Offline
          Overfiend
          wrote on last edited by
          #4

          Im trying but i need some help! because i still cant get this to work

          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