Does this make any sense?

This is a discussion on Does this make any sense? within the C Programming forums, part of the General Programming Boards category; For this line: (assuming you make the above fix...) Code: strcat(lineh,line);//append line to accomodate lineh You are copying a string ...

  1. #16
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    For this line: (assuming you make the above fix...)
    Code:
    strcat(lineh,line);//append line to accomodate lineh
    You are copying a string (char array) into a char. Bad idea. Fix it.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  2. #17
    Jack of many languages Dino's Avatar
    Join Date
    Nov 2007
    Location
    Katy, Texas
    Posts
    2,309
    For this warning:
    Code:
     
    lineh = linea;
    You are trying to assign a pointer to an int array to a 1 byte char. Bad idea. Fix it.
    Mac and Windows cross platform programmer. Ruby lover.

    Quote of the Day
    12/20: Mario F.:I never was, am not, and never will be, one to shut up in the face of something I think is fundamentally wrong.

    Amen brother!

  3. #18
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230
    I have some ideas but i want to be perfectly clear that there is a way to fix this without rewriting the entire code.

  4. #19
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    I have some ideas but i want to be perfectly clear that there is a way to fix this without rewriting the entire code.
    Is that a question? There's a lot of little mistakes, so although you probably don't have to start from scratch, I would definitely go through line by line, and confirm that every line actually does what you think it does when you execute it.

  5. #20
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,656
    Yeah, read this A development process

    Then rewrite the code in much smaller steps, compiling and testing as you go.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  6. #21
    That weird Java guy xniinja's Avatar
    Join Date
    Jun 2010
    Posts
    230
    Thanks

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

Similar Threads

  1. make with debug options
    By Andaluz in forum Linux Programming
    Replies: 4
    Last Post: 01-19-2010, 09:24 AM
  2. Does this even remotely make sense
    By hckr83 in forum C Programming
    Replies: 6
    Last Post: 12-23-2005, 04:02 PM
  3. Question about atheists
    By gcn_zelda in forum A Brief History of Cprogramming.com
    Replies: 160
    Last Post: 08-11-2003, 11:50 AM
  4. 'functions' in make?
    By mart_man00 in forum C Programming
    Replies: 1
    Last Post: 06-21-2003, 02:16 PM
  5. Foreigners don't make sense
    By Shadow in forum A Brief History of Cprogramming.com
    Replies: 19
    Last Post: 04-25-2002, 02:31 PM

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