Fri Apr 26 15:28:39 2024
EVENTS
 FREE
SOFTWARE
INSTITUTE

POLITICS
JOBS
MEMBERS'
CORNER

MAILING
LIST

NYLXS Mailing Lists and Archives
NYLXS Members have a lot to say and share but we don't keep many secrets. Join the Hangout Mailing List and say your peice.

DATE 2005-01-01

HANGOUT

2024-04-26 | 2024-03-26 | 2024-02-26 | 2024-01-26 | 2023-12-26 | 2023-11-26 | 2023-10-26 | 2023-09-26 | 2023-08-26 | 2023-07-26 | 2023-06-26 | 2023-05-26 | 2023-04-26 | 2023-03-26 | 2023-02-26 | 2023-01-26 | 2022-12-26 | 2022-11-26 | 2022-10-26 | 2022-09-26 | 2022-08-26 | 2022-07-26 | 2022-06-26 | 2022-05-26 | 2022-04-26 | 2022-03-26 | 2022-02-26 | 2022-01-26 | 2021-12-26 | 2021-11-26 | 2021-10-26 | 2021-09-26 | 2021-08-26 | 2021-07-26 | 2021-06-26 | 2021-05-26 | 2021-04-26 | 2021-03-26 | 2021-02-26 | 2021-01-26 | 2020-12-26 | 2020-11-26 | 2020-10-26 | 2020-09-26 | 2020-08-26 | 2020-07-26 | 2020-06-26 | 2020-05-26 | 2020-04-26 | 2020-03-26 | 2020-02-26 | 2020-01-26 | 2019-12-26 | 2019-11-26 | 2019-10-26 | 2019-09-26 | 2019-08-26 | 2019-07-26 | 2019-06-26 | 2019-05-26 | 2019-04-26 | 2019-03-26 | 2019-02-26 | 2019-01-26 | 2018-12-26 | 2018-11-26 | 2018-10-26 | 2018-09-26 | 2018-08-26 | 2018-07-26 | 2018-06-26 | 2018-05-26 | 2018-04-26 | 2018-03-26 | 2018-02-26 | 2018-01-26 | 2017-12-26 | 2017-11-26 | 2017-10-26 | 2017-09-26 | 2017-08-26 | 2017-07-26 | 2017-06-26 | 2017-05-26 | 2017-04-26 | 2017-03-26 | 2017-02-26 | 2017-01-26 | 2016-12-26 | 2016-11-26 | 2016-10-26 | 2016-09-26 | 2016-08-26 | 2016-07-26 | 2016-06-26 | 2016-05-26 | 2016-04-26 | 2016-03-26 | 2016-02-26 | 2016-01-26 | 2015-12-26 | 2015-11-26 | 2015-10-26 | 2015-09-26 | 2015-08-26 | 2015-07-26 | 2015-06-26 | 2015-05-26 | 2015-04-26 | 2015-03-26 | 2015-02-26 | 2015-01-26 | 2014-12-26 | 2014-11-26 | 2014-10-26 | 2014-09-26 | 2014-08-26 | 2014-07-26 | 2014-06-26 | 2014-05-26 | 2014-04-26 | 2014-03-26 | 2014-02-26 | 2014-01-26 | 2013-12-26 | 2013-11-26 | 2013-10-26 | 2013-09-26 | 2013-08-26 | 2013-07-26 | 2013-06-26 | 2013-05-26 | 2013-04-26 | 2013-03-26 | 2013-02-26 | 2013-01-26 | 2012-12-26 | 2012-11-26 | 2012-10-26 | 2012-09-26 | 2012-08-26 | 2012-07-26 | 2012-06-26 | 2012-05-26 | 2012-04-26 | 2012-03-26 | 2012-02-26 | 2012-01-26 | 2011-12-26 | 2011-11-26 | 2011-10-26 | 2011-09-26 | 2011-08-26 | 2011-07-26 | 2011-06-26 | 2011-05-26 | 2011-04-26 | 2011-03-26 | 2011-02-26 | 2011-01-26 | 2010-12-26 | 2010-11-26 | 2010-10-26 | 2010-09-26 | 2010-08-26 | 2010-07-26 | 2010-06-26 | 2010-05-26 | 2010-04-26 | 2010-03-26 | 2010-02-26 | 2010-01-26 | 2009-12-26 | 2009-11-26 | 2009-10-26 | 2009-09-26 | 2009-08-26 | 2009-07-26 | 2009-06-26 | 2009-05-26 | 2009-04-26 | 2009-03-26 | 2009-02-26 | 2009-01-26 | 2008-12-26 | 2008-11-26 | 2008-10-26 | 2008-09-26 | 2008-08-26 | 2008-07-26 | 2008-06-26 | 2008-05-26 | 2008-04-26 | 2008-03-26 | 2008-02-26 | 2008-01-26 | 2007-12-26 | 2007-11-26 | 2007-10-26 | 2007-09-26 | 2007-08-26 | 2007-07-26 | 2007-06-26 | 2007-05-26 | 2007-04-26 | 2007-03-26 | 2007-02-26 | 2007-01-26 | 2006-12-26 | 2006-11-26 | 2006-10-26 | 2006-09-26 | 2006-08-26 | 2006-07-26 | 2006-06-26 | 2006-05-26 | 2006-04-26 | 2006-03-26 | 2006-02-26 | 2006-01-26 | 2005-12-26 | 2005-11-26 | 2005-10-26 | 2005-09-26 | 2005-08-26 | 2005-07-26 | 2005-06-26 | 2005-05-26 | 2005-04-26 | 2005-03-26 | 2005-02-26 | 2005-01-26 | 2004-12-26 | 2004-11-26 | 2004-10-26 | 2004-09-26 | 2004-08-26 | 2004-07-26 | 2004-06-26 | 2004-05-26 | 2004-04-26 | 2004-03-26 | 2004-02-26 | 2004-01-26 | 2003-12-26 | 2003-11-26 | 2003-10-26 | 2003-09-26 | 2003-08-26 | 2003-07-26 | 2003-06-26 | 2003-05-26 | 2003-04-26 | 2003-03-26 | 2003-02-26 | 2003-01-26 | 2002-12-26 | 2002-11-26 | 2002-10-26 | 2002-09-26 | 2002-08-26 | 2002-07-26 | 2002-06-26 | 2002-05-26 | 2002-04-26 | 2002-03-26 | 2002-02-26 | 2002-01-26 | 2001-12-26 | 2001-11-26 | 2001-10-26 | 2001-09-26 | 2001-08-26 | 2001-07-26 | 2001-06-26 | 2001-05-26 | 2001-04-26 | 2001-03-26 | 2001-02-26 | 2001-01-26 | 2000-12-26 | 2000-11-26 | 2000-10-26 | 2000-09-26 | 2000-08-26 | 2000-07-26 | 2000-06-26 | 2000-05-26 | 2000-04-26 | 2000-03-26 | 2000-02-26 | 2000-01-26 | 1999-12-26

Key: Value:

Key: Value:

MESSAGE
DATE 2005-01-26
FROM Ruben Safir
SUBJECT Re: [hangout] Simple C question

On Tue, 2005-01-25 at 16:03, Billy wrote:
> Inker, Evan wrote:
> > Check this out
> >
> > strcopy.c
> >
> > /* strcopy.c written by detour-at-metalshell.com
> > *
> > * example of a string copying function.
> > *
> > * http://www.metalshell.com/
> > *
> > */
> >
> > #include
> > #include
> >
> > void strcopy(const char *, char *);
> >
> > int main() {
> > char string1[] = "This is string1";
> > char string2[] = "This is string2";
> >
> > strcopy(string1, string2);
> > printf("String2: %s", string2);
> > }
> >
> > void strcopy(const char * str1, char * str2) {
> > int x = 0;
> >
> > /* change the size of string2 to the size of string1 */
> > realloc(str2, sizeof(str1));
> >
> > do {
> > str2[x] = str1[x];
> > } while (str1[x++] != '\0');
> >
> > }
>
>
> This program is incorrect.
> YOU CANNOT overwrite the contents of string2.


Why not? It is not a string literal.

> It is also illegal to
> realloc() a pointer which was not obtained by malloc().
> also, realloc is free to move the block. you have to use its return
> value to update the pointer. There's just so much wrong...
>
> I DON'T RECOMMEND learning from this example.
>

I agree. There is no reason to rewrite strncpy

Ruben


____________________________
NYLXS: New Yorker Free Software Users Scene
Fair Use -
because it's either fair use or useless....
NYLXS is a trademark of NYLXS, Inc

  1. 2005-01-31 From: "Martin, Jared" <JMartin-at-dglaw.com> Fw: [hangout] [visham-at-proexam.org: I will like to Register/And I will also like to lern more about this class]
  2. 2005-01-30 From: "P.Robert Marino" <rob-at-concord-hs.org> Re: [hangout] Re: Paid DOE Security Deployment Internship Job Description
  3. 2005-01-30 From: "rc" <ray-pub-at-rcn.com> Subject: [hangout] classes
  4. 2005-01-30 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] We should Celebrate!
  5. 2005-01-30 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Subject: [hangout] Tax that funded the Spano-American war could be extended
  6. 2005-01-30 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Re: [hangout] January 30, Sunday, Kings Games. Is anybody or everybody going to be there?
  7. 2005-01-30 swd <sderrick-at-optonline.net> Subject: [hangout] January 30, Sunday, Kings Games. Is anybody or everybody going to be
  8. 2005-01-30 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Re: [hangout] Future might be looking brighter
  9. 2005-01-30 Ron Guerin <ron-at-vnetworx.net> Re: [hangout] Future might be looking brighter
  10. 2005-01-29 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Re: [hangout] Future might be looking brighter
  11. 2005-01-29 Billy <billy-at-dadadada.net> Re: Fw: [hangout] [visham-at-proexam.org: I will like to Register/And
  12. 2005-01-29 Billy <billy-at-dadadada.net> Re: [hangout] Re: Paid DOE Security Deployment Internship Job Description
  13. 2005-01-28 From: "Martin, Jared" <JMartin-at-dglaw.com> Fw: [hangout] [visham-at-proexam.org: I will like to Register/And I will also like to lern more about this class]
  14. 2005-01-28 Ruben Safir Secretary NYLXS <ruben-at-mrbrklyn.com> Subject: [hangout] Future might be looking brighter
  15. 2005-01-27 Ruben Safir Secretary NYLXS <ruben-at-mrbrklyn.com> Subject: [hangout] [visham-at-proexam.org: I will like to Register/And I will also like to lern more about this class]
  16. 2005-01-27 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] MySQL installations targeted by Forbot worm variant
  17. 2005-01-27 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Concerns mount over Lenovo's IBM deal
  18. 2005-01-27 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] New Cold Medication Restrictions will make them Pharmacy only
  19. 2005-01-27 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] I've been Robbed - NOT
  20. 2005-01-26 Ruben Safir Secretary NYLXS <ruben-at-mrbrklyn.com> Re: [hangout] Simple C question
  21. 2005-01-26 Billy <billy-at-dadadada.net> Re: [hangout] Simple C question
  22. 2005-01-26 Ruben Safir <ruben-at-mrbrklyn.com> Re: [hangout] Simple C question
  23. 2005-01-26 Ruben Safir <ruben-at-mrbrklyn.com> Re: [hangout] Simple C question
  24. 2005-01-25 From: "rc" <ray-pub-at-rcn.com> Subject: [hangout] FOSS Biz Solution Thoughts?
  25. 2005-01-25 From: "Martin, Jared" <JMartin-at-dglaw.com> RE: [hangout] Simple C question
  26. 2005-01-25 Steve Milo <slavik914-at-mrbrklyn.com> Re: [hangout] Simple C question
  27. 2005-01-25 Billy <billy-at-dadadada.net> Re: [hangout] Simple C question
  28. 2005-01-25 Billy <billy-at-dadadada.net> Re: [hangout] Simple C question
  29. 2005-01-25 James Linder <jhl-at-jlinder.com> Re: [hangout] Simple C question
  30. 2005-01-25 From: "Inker, Evan" <EInker-at-gam.com> RE: [hangout] Simple C question
  31. 2005-01-25 From: "Martin, Jared" <JMartin-at-dglaw.com> Subject: [hangout] Simple C question
  32. 2005-01-25 Ron Guerin <ron-at-vnetworx.net> Re: [hangout] Ron G.
  33. 2005-01-25 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] IBM goes silent on Linux desktop effort
  34. 2005-01-25 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Subject: [hangout] Ron G.
  35. 2005-01-25 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Flame Wars, Forks and Freedom
  36. 2005-01-24 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] VeriSign breaks silence on domain hijack
  37. 2005-01-23 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] Mama - don't let your kids grow up to be programers
  38. 2005-01-21 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Subject: [hangout] Paging serge.
  39. 2005-01-20 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] A Take on the Workstation Market Today
  40. 2005-01-20 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] OS News of the Day - Jan 20, 2005
  41. 2005-01-20 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Re: [hangout] FIX Protocol
  42. 2005-01-20 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Subject: [hangout] FIX Protocol
  43. 2005-01-20 From: "Inker, Evan" <EInker-at-gam.com> RE: [hangout] NY Linux Users Grp. 27 Jan. Meeting: Elliotte Rusty
  44. 2005-01-20 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Re: [hangout] NY Linux Users Grp. 27 Jan. Meeting: Elliotte Rusty Harold -on- Extensible Markup Language (XML)
  45. 2005-01-20 Ron Guerin <ron-at-vnetworx.net> Subject: [hangout] NY Linux Users Grp. 27 Jan. Meeting: Elliotte Rusty Harold -on-
  46. 2005-01-20 swd <sderrick-at-optonline.net> RE: [hangout] FIX Protocol
  47. 2005-01-19 From: "Inker, Evan" <EInker-at-gam.com> RE: [hangout] Staff Development and Organizational Capacity
  48. 2005-01-19 Ruben Safir <ruben-at-mrbrklyn.com> RE: [hangout] Staff Development and Organizational Capacity
  49. 2005-01-18 From: "Martin, Jared" <JMartin-at-dglaw.com> RE: [hangout] Staff Development and Organizational Capacity
  50. 2005-01-16 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] Lotus 1-2-3 Free Software
  51. 2005-01-14 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] FBI may scrap $170 million project
  52. 2005-01-13 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Linux misperceptions the greatest challenge: Novell
  53. 2005-01-13 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Red Hat, SuSE release Linux patches
  54. 2005-01-13 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Red Hat tries again with Linux enthusiasts
  55. 2005-01-13 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Big Brother Bloomberg is watching.
  56. 2005-01-13 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Subject: [hangout] Paging Serge.
  57. 2005-01-13 Ruben Safir Secretary NYLXS <ruben-at-mrbrklyn.com> Re: [hangout] More wonderful BS from Columbia University
  58. 2005-01-13 Billy <billy-at-dadadada.net> Re: [hangout] Why is he still able to teach!!!
  59. 2005-01-13 Billy <billy-at-dadadada.net> Re: [hangout] More wonderful BS from Columbia University
  60. 2005-01-13 Ruben Safir Secretary NYLXS <ruben-at-mrbrklyn.com> Re: [hangout] More wonderful BS from Columbia University
  61. 2005-01-12 Billy <billy-at-dadadada.net> Re: [hangout] More wonderful BS from Columbia University
  62. 2005-01-12 dspira-at-att.net Subject: [hangout] Why is he still able to teach!!!
  63. 2005-01-12 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] More wonderful BS from Columbia University
  64. 2005-01-12 From: "Inker, Evan" <EInker-at-gam.com> RE: [hangout] More wonderful BS from Columbia University
  65. 2005-01-12 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] Open Office and Web Publishing
  66. 2005-01-12 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] Bird Watching
  67. 2005-01-12 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] GNOME Journal, January 2005 Edition
  68. 2005-01-11 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] IBM - Software Patents
  69. 2005-01-11 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] NYLXS Needs You !! Call Out for Volunteers
  70. 2005-01-11 Ruben Safir <ruben-at-mrbrklyn.com> Re: [hangout] Staff Development and Organizational Capacity
  71. 2005-01-11 From: "Inker, Evan" <EInker-at-gam.com> RE: [hangout] Staff Development and Organizational Capacity
  72. 2005-01-11 From: "Inker, Evan" <EInker-at-gam.com> Subject: [hangout] Staff Development and Organizational Capacity
  73. 2005-01-11 wjc <wjc-at-optonline.net> Subject: [hangout] test
  74. 2005-01-09 Ruben Safir <ruben-at-mrbrklyn.com> Subject: [hangout] It never ends......
  75. 2005-01-06 Billy <billy-at-dadadada.net> Re: [hangout] What is available for creating GUI's?
  76. 2005-01-06 From: "P.Robert Marino" <rob-at-concord-hs.org> Subject: [hangout] the contract number for the microsoft contract with the NYC DOE
  77. 2005-01-06 From: "Steve Milo" <slavik914-at-mrbrklyn.com> Subject: [hangout] What is available for creating GUI's?

NYLXS are Do'ers and the first step of Doing is Joining! Join NYLXS and make a difference in your community today!