Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How To Count The Number Of Characters?

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 13-02-2009
Member
 
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?

Reply With Quote
  #2  
Old 13-02-2009
Member
 
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
Reply With Quote
  #3  
Old 13-02-2009
Member
 
Join Date: May 2008
Posts: 2,389
Re: How To Count The Number Of Characters?

Quote:
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);
}
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How To Count The Number Of Characters?"
Thread Thread Starter Forum Replies Last Post
How to count number of characters in Excel Bankebihari Windows Software 6 15-05-2012 04:52 PM
JavaScript to count number of images Juan-Carlos Software Development 5 11-12-2009 05:22 AM
PHP - Count number of words GlassFish Software Development 3 27-11-2009 01:19 PM
Count the number of times yes appears in a range in excel Andy Candy Windows Software 3 17-08-2009 12:33 PM
How to count number of words automatically? Basaam Windows Software 4 25-04-2009 10:00 PM


All times are GMT +5.5. The time now is 05:36 PM.