Welcome to Dream.In.Code
Getting C++ Help is Easy!

Join 136,416 C++ Programmers for FREE! Get instant access to thousands of C++ experts, tutorials, code snippets, and more! There are 2,410 people online right now. Registration is fast and FREE... Join Now!




frequency of characters in disk file

 
Reply to this topicStart new topic

frequency of characters in disk file, giving lots of errors

avinandanaot
15 Oct, 2008 - 06:25 AM
Post #1

New D.I.C Head
*

Joined: 14 Oct, 2008
Posts: 13


My Contributions
CODE

#include<stdio.h>
#include<conio.h>
void main()
{
char y,c;
static int x[256],i,j;
FILE*fptr;
clrscr();
fptr=fopen("a.text","r");
{
printf("\n Error in openingfile");
exit(0);
}
forj=0;j<256;j++)
{
while(!feof(fptr))
{
y=fgetc(fptr);
if(y==j)
x[i]++;
}
i++;
rewind(fptr);
}
for(i=0;i<256;i++)
printf("\n The frequency of the character %c is %d",i,x[i]);
}


***Added code tags. jjsaw5***
User is offlineProfile CardPM
+Quote Post

jjsaw5
RE: Frequency Of Characters In Disk File
15 Oct, 2008 - 06:43 AM
Post #2

I must break you
Group Icon

Joined: 4 Jan, 2008
Posts: 1,404



Thanked: 6 times
Dream Kudos: 125
Expert In: HTML, CSS, Database,

My Contributions
First please use code tags when you are posting code.


Second....what is your question? You just posted code and said it's giving errors.

What errors is it giving you? What is this code supposed to do?



You need to provide more information please.
User is online!Profile CardPM
+Quote Post

Reply to this topicStart new topic
Time is now: 12/2/08 12:51PM

Live C++ Help!

C++ Tutorials

Reference Sheets

C++ Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month