Thread: argv problems

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Quote Originally Posted by aadil7 View Post
    thanks for your input but just to let you know ive not let nothing till the last minute and this is not no homework!
    i take c seriously and want to learn the language, so i guess i am sorry for posting a genuine issue on a forum, even though a forum is where all different people come together to help solve issues and give help.
    If you really did take this seriously you would have done all your research before coming to ask for help. You have not posted any kind of code that you WROTE since the beginning of the thread, you DON'T ASK QUESTIONS THE SMART WAY, and you generally just keep wasting our time.

    People here give help all the time, but only to people who take their work seriously and write THEIR OWN CODE.

    I think it's about time this thread was closed.
    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.

  2. #2
    Registered User
    Join Date
    Mar 2010
    Posts
    85
    Quote Originally Posted by claudiu View Post
    If you really did take this seriously you would have done all your research before coming to ask for help. You have not posted any kind of code that you WROTE since the beginning of the thread, you DON'T ASK QUESTIONS THE SMART WAY, and you generally just keep wasting our time.

    People here give help all the time, but only to people who take their work seriously and write THEIR OWN CODE.

    I think it's about time this thread was closed.
    if you do get the thread closed then fair enough! but then if people cant LEARN certain detailed things then i dont really know where the tag your resource for the C and C++ came from on this site.

  3. #3
    Registered User
    Join Date
    Jan 2010
    Location
    Ca, US
    Posts
    29
    You asked how do to get the last argument from argv and you were told
    argv[argc-1] that's a great answer.
    You asked how you access all of argv[] and your were told to loop them, and that is also a good answer.

    Do you have a new question? If so just ask it.
    But most people also show the code they have tried to let others know you have put some effort into solving your problem.

    Dylan

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    85
    ok then well the part i need to figure out was for the following
    Code:
     
        outfiled = open(argv[numfiles], O_CREAT | O_WRONLY | O_EXCL , S_IRUSR|S_IWUSR);
        if (outfiled == -1)
        {
          printf("%s\n", argv[numfiles]);
          printf("%s cannot be opened\n", argv[numfiles]);
          exit;
        }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Visual C++ 2010 express problems
    By dnj23 in forum Windows Programming
    Replies: 6
    Last Post: 08-10-2010, 06:16 AM
  2. Most Common problems in C
    By Bayint Naung in forum C Programming
    Replies: 18
    Last Post: 06-02-2010, 08:20 PM
  3. argc, argv
    By Martas in forum C Programming
    Replies: 6
    Last Post: 11-19-2009, 09:39 AM
  4. fread problems or memory problems
    By Lechuza in forum C Programming
    Replies: 1
    Last Post: 03-22-2009, 12:45 PM
  5. more argv and argc
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 09-08-2001, 11:04 PM