Results 1 to 3 of 3

Thread: How To Count The Number Of Characters?

  1. #1
    Join Date
    Jan 2009
    Posts
    48

    How To Count The Number Of Characters?

    hi,
    i want to know how to count the no of character which are present in the into a file?

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: How To Count The Number Of Characters?

    i don’t know of any direct method of determining the number of characters in a text file (for example, binding to the file and then looking at some sort of Number Of Characters property).

    Code:
    Const ForReading = 1
    
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objFile = objFSO.OpenTextFile("C:\Scripts\Test.txt", ForReading)
    
    strCharacters = objFile.ReadAll
    
    strCharacters = Replace(strCharacters, vbCrLf, "")
    Wscript.Echo Len(strCharacters)
    
    objFile.Close

  3. #3
    Join Date
    May 2008
    Posts
    2,389

    Re: How To Count The Number Of Characters?

    i want to know how to count the no of character which are present in the into a file?
    #include <stdio.h>
    #include <stdlib.h>
    const char FILE_NAME[] = "input.txt";

    int main()
    {
    int count = 0;
    FILE *in_file;
    int ch;
    in_file = fopen(FILE_NAME, "r");
    if (in_file == NULL)
    {

    printf("Cannot open %s\n", FILE_NAME);
    exit(8);
    }

    while (1)
    {
    ch = fgetc(in_file);
    if (ch == EOF)
    break;
    ++count;
    }
    printf("Number of characters in %s is %d\n",
    FILE_NAME, count);

    fclose(in_file);
    return (0);
    }

Similar Threads

  1. How to count number of characters in Excel
    By Bankebihari in forum Windows Software
    Replies: 6
    Last Post: 15-05-2012, 04:52 PM
  2. JavaScript to count number of images
    By Juan-Carlos in forum Software Development
    Replies: 5
    Last Post: 11-12-2009, 05:22 AM
  3. PHP - Count number of words
    By GlassFish in forum Software Development
    Replies: 3
    Last Post: 27-11-2009, 01:19 PM
  4. Count the number of times yes appears in a range in excel
    By Andy Candy in forum Windows Software
    Replies: 3
    Last Post: 17-08-2009, 12:33 PM
  5. How to count number of words automatically?
    By Basaam in forum Windows Software
    Replies: 4
    Last Post: 25-04-2009, 10:00 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,022,618.14248 seconds with 16 queries