#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
char c;
{
char text[1000];
FILE *fp=fopen("filename", "r");
int i=0;
while((c=fgetc(c))!=EOF)
{
do something
}
}
Jose_12 0 Newbie Poster
Recommended Answers
Jump to PostAs I recall you should use
fseek
andftell
to get the file size, themmalloc
to allocate enough space to hold the entire file, thenrewind
andfread
to read the entire file at once.
All 2 Replies
Reverend Jim 5,259 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.