I have recently(yesterday) started trying to learn linux and to program in this os. Now, one interesting and probably easy problem I came across while surfing the net was something like this:
Consider a C program that takes a directory as an argument in the command line and calculates the sum of all the files' dimensions that are in the directory's tree.
Now, due to the fact that I've been doing a lot of reading and researching in a short matter of time, all my knowledge is piled up in my brian creating a cloud of confusion. If anyone could help me with the code, I'd be really thankful.
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
C program under Linux
Re: C program under Linux
Homework is intended to help you learn to do it yourself, not to have someone else do it for you.
Re: C program under Linux
Hey. It is not homework, I assure youdasein wrote:Homework is intended to help you learn to do it yourself, not to have someone else do it for you.
Re: C program under Linux
Yes it is, and recognizably so.JoeyMoey wrote:Hey. It is not homework, I assure you
Achieving the stated goal in *nix doesn't actually require so much as a single, solitary line of C code. Not even one. So the only reason to do it in C is as a pedagogical exercise.
DYODH. Seriously.
Edit: Some pinhead over @ stackexchange did most of the assignment for him. (A$$hat.)
Last edited by dasein on 2017-01-05 19:35, edited 1 time in total.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: C program under Linux
No need for a C program, the 'ls' command is all you need,
To help you gets started with the C programming:
https://linuxconfig.org/c-development-o ... oduction-i
Some searches will find more tutorials, if you do not like that one.
C program under Linux
Code: Select all
man ls
Code: Select all
~$ ls -h -l -s
total 1.2G
1.8M -rw-r--r-- 1 garry garry 1.8M Oct 21 11:56 1-OpenBsd-test.gif
180K -rw-r--r-- 1 garry garry 17
1.1G -rw-r--r--
###snipped, produces a list of the files,and sizes ,in the directory, as well as the total size
You just started yesterday ? Read some tutorials on basic linux commands.Post by JoeyMoey » 2017-01-05 12:30
I have recently(yesterday) started trying to learn linux and to program in this os.
Then what is it ?JoeyMoey wrote:
Hey. It is not homework, I assure you
To help you gets started with the C programming:
https://linuxconfig.org/c-development-o ... oduction-i
Some searches will find more tutorials, if you do not like that one.
C program under Linux
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?