I was wondering the best way to define and loop through a character
array. Most lines of the file I am processing are 80 characters long
but when an error occurs in the client which created the log sometimes
they can be much longer so what's the best way to determine the array
and define it?
char s[80];
vs
#define MAX 100
char s[MAX];
and
int i;
for (i=0; i < sizeof(s); i++) { printf("%s", s[i]);)
I can read each line of my log file using fgets, now should I use
fixed arrays like:
char s[80];
FILE *fp;
fp = fopen("foo.txt","r");
fgets(s,sizeof(s),fp);
Or would it be better assign a pointer value for the first char each
line:
char *s[80];
fgets(*s,sizeof(s),fp);
Considering that later on I will want to tokenize each line and send
the values of the various tokens to different output files.
Lisp 9000
--
comp.lang.c.moderated - moderation address: clcm@[EMAIL PROTECTED]
-- you must
have an appropriate newsgroups line in your header for your mail to be
seen,
or the newsgroup name in square brackets in the subject line. Sorry.


|