How to read in file size
Haseen I. Alam
halam2 at umn-d-ub.D.UMN.EDU
Tue Jun 12 15:32:47 AEST 1990
I am using BSD Unix 4.2 on Sun 3's, a Sparc, and on a Encore multimax. I
do not think this is a machine dependent question, but this info is for
anyone who might flame me later for not specifing it.
I am aware of the wc (word count) program in unix. I can use something
like this in my C program.....
system ("wc -c filename") ;
This will execute the wc command and print out the info out to the terminal.
But I need to read that into my program. How can I make this work? This
method has a certain drawback. I had to hard code the filename. I would
need to be able to use different filenames from the command line and get
similar info for further processing. Is there any variations to the system
command that I am not aware of? Is there a built in C function that will
do this.
Now speed is a concern in what I am doing. I can not open each file at a
time and count up the characters. Files are big and I use 2 to 5 of them at
once.
I do not mean to waste bandwidth with questions that have recently been
answered. I read this group regularly. There was some postings about a
compilation of frequently asked questions. Where can I access that info?
Any helpful gesture will be highly appreciated. Thanks.
Haseen.
--
.--------------------------------------------------------------------.
| Haseen Ibne Alam Tel: (218)-728-2139 |
| email : halam1 at ub.d.umn.edu or halam at cola.d.umn.edu |
`--------------------------------------------------------------------'
More information about the Comp.lang.c
mailing list