help on C on Windows needed desperately

This is a discussion on help on C on Windows needed desperately within the C Programming forums, part of the General Programming Boards category; Hi, I have to write "menu" type (for whatever that means) C program that does the following four things 1. ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    9

    help on C on Windows needed desperately

    Hi,

    I have to write "menu" type (for whatever that means) C program that does the following four things
    1. Allows you to choose a working directory and lists all the .c files in that directory keeping them on the screen constantly.
    2. Counts the intervals and tabulations in each row in the .c files
    3. The average number of characters in each row with respect to the total number of characters in the whole file (i really do not understand this one)
    4. Enumerates all the commented rows

    This program has to run on WINDOWS (I guess with the C compiler of visual studio !?!) and I have to access to a windows machine, apart for the fact that I only have a vague idea of how to do all of this!

    Any help will be greatly appreciated ! ! !

    Thanks

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Is this a console or GUI program?

    Is this homework?

    Who dreams this crap up?

    In my (not always) humble opinon the best free C compiler for windows is going to be PellesC ...
    smorgasbordet - Pelles C
    Last edited by CommonTater; 11-28-2010 at 12:53 PM. Reason: Laserlight told me to... :)

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    9
    [QUOTE=CommonTater;986194]Is this a console or GUI program?

    console --- i think

    Is this homework?

    something like that

    Who dreams this crap up?

    i know, right!

  4. #4
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    So, have you been able to figure out the rudiments of what you need to do?

    Open directory... list files... open files... buy more Aspirin... etc?

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    9
    that's pretty much all I have figured out

  6. #6
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Is this a sort of: "code statistics on crack" ?!
    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.

  7. #7
    Registered User
    Join Date
    Nov 2010
    Posts
    9
    i guess

  8. #8
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by invalidPreproc View Post
    that's pretty much all I have figured out
    I think you're missing my point...
    Excuse me for speaking directly....

    We are not going to do this FOR you but if you make a sincere effort some of us will help do it WITH you... But you do need to show that you've at least tried.

  9. #9
    Registered User
    Join Date
    Nov 2010
    Posts
    9
    i think do understand the general principals of class assignments
    however as I already said i do not have access to a windows machine and so i have no way to write and test anything that is platform specific
    if anyone has the time to code it and quickly test it that would be greatly appreciated

  10. #10
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314

  11. #11
    Registered User
    Join Date
    Nov 2010
    Posts
    9
    ...all i need is a console application...

  12. #12
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,981
    You probably don't even need anything platform specific, so don't use that as an excuse.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  13. #13
    Registered User
    Join Date
    Nov 2010
    Posts
    9
    ok --- then here is a very specific question --- how do you list the files in a directory in a platform-independent way?

  14. #14
    Registered User
    Join Date
    May 2010
    Location
    Naypyidaw
    Posts
    1,314
    You can use POSIX library function
    C POSIX library - Wikipedia, the free encyclopedia

  15. #15
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    20,981
    Quote Originally Posted by invalidPreproc
    ok --- then here is a very specific question --- how do you list the files in a directory in a platform-independent way?
    I use Boost.Filesystem, but that is a C++ library. I will concede that this is an oversight on my part in the sense that the C standard library does not have such facilities.

    But come on, you wrote this:
    Quote Originally Posted by invalidPreproc
    if anyone has the time to code it and quickly test it that would be greatly appreciated
    That is basically saying "please do my homework for me, thanks!" Even if you have trouble with part 1 because you are using a different OS from what is convenient, what about parts 2 to 4?

    Furthermore, what compiler is your instructor going to use to compile your code? If you have the freedom to choose, Bayint Naung's suggestion becomes very feasible.
    C + C++ Compiler: MinGW port of GCC
    Version Control System: Bazaar

    Look up a C++ Reference and learn How To Ask Questions The Smart Way

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Windows-Linux Comparison
    By Yarin in forum General Discussions
    Replies: 80
    Last Post: 02-14-2010, 04:10 PM
  2. Replies: 0
    Last Post: 12-08-2009, 06:39 AM
  3. Program works on Windows XP and 2000, not on 98 or ME
    By MidnightlyCoder in forum C++ Programming
    Replies: 7
    Last Post: 03-10-2006, 02:36 PM
  4. SDL and Windows
    By nickname_changed in forum Windows Programming
    Replies: 14
    Last Post: 10-24-2003, 12:19 AM
  5. Windows Memory Allocation :: C++
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 11-03-2002, 11:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21