Thread: c project how to

  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    7

    c project how to

    Hello everybody. I know c good, but don't have any practice writing even little project (at least 1000 strings). Now i want to begin something but confused with project organization, how to organize folders, their names, where to locate makefiles and etc. Browsed many other open source projects to see some standard or convention. Nothing and in the internet couldn't not find any useful info. Please, i need your help. thanks.
    Last edited by tiweak; 03-28-2012 at 10:35 AM.

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    You couldn't be more vague if you tried. What is it your asking exactly?
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > I know c good, but don't have any practice writing even little project
    Then you know nothing about C.
    Memorising the syntax does not make you a programmer.

    A program to read 1000 strings, and do a few basic operations (sort, search, print) doesn't need a project - it can be done comfortably in a few hundred lines in a single source file.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Registered User
    Join Date
    Feb 2012
    Posts
    7
    In projects i browsed were folders bin, doc, lib, src, include etc. In some projects makefile was in each folder. Confusing. I want to ask how to arrange files, how to name folders? Is there any standard or convention for future maintenence, as for example convention about variable naming in c?

  5. #5
    Registered User
    Join Date
    Feb 2012
    Posts
    7
    Quote Originally Posted by Salem View Post
    > I know c good, but don't have any practice writing even little project
    Then you know nothing about C.
    Memorising the syntax does not make you a programmer.

    A program to read 1000 strings, and do a few basic operations (sort, search, print) doesn't need a project - it can be done comfortably in a few hundred lines in a single source file.
    yeah, i wrote that kind of things. now i want to make a real program.

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Tiny projects are a single source file.

    Small projects are a handful of files in the same directory.

    Medium sized projects might have a root directory and a few sub-dirs (1 level deep)

    Very large projects are veritable forests of directories and sub-directories.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Jul 2011
    Location
    Champaign, Illinois, United States
    Posts
    27
    Somebody correct me if I am wrong but in my experience I have never seen a specific "standard" or custom when it comes to filenaming and filesystem structure. I think it is up to the project owner/manager to set a standard and then everyone follows that. I know Ubuntu and OpenOffice have their own standards and you are required to follow what they set up.

  8. #8
    Registered User
    Join Date
    Feb 2012
    Posts
    7
    Quote Originally Posted by Salem View Post
    Tiny projects are a single source file.

    Small projects are a handful of files in the same directory.

    Medium sized projects might have a root directory and a few sub-dirs (1 level deep)

    Very large projects are veritable forests of directories and sub-directories.
    thanks salem. it was very usefull.

    i knew about the first 2. but my project would be medium sized. yeah it would be hard for project beginner. now you came to my question. how to call these sub-dirs and how to arrange files in these sub-dirs? is there any convention or standard?

  9. #9
    Registered User
    Join Date
    Feb 2012
    Posts
    7
    at last found something:
    c project file structure - Google Search
    c project folder structure - Google Search

    thanks to everybody for quick replies

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Classes Project (Not class project)
    By adam.morin in forum C++ Programming
    Replies: 3
    Last Post: 02-28-2011, 01:48 AM
  2. Paid project - The Free Marketing Project
    By sharefree in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 10-27-2010, 02:15 PM
  3. [NEED HELP] Project
    By James245 in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 10-15-2007, 07:08 AM
  4. Need help on a C project.
    By Veda in forum C Programming
    Replies: 3
    Last Post: 10-16-2002, 05:19 PM
  5. your 11th & 12th grade c++ project or similar project
    By sleepyheadtony in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 01-13-2002, 05:14 PM