Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

strcpy causing segfaults from source

Name: Anonymous 2010-08-12 14:42

A snippet in my code goes something like

puts(string1);
strcpy(string2, string1);
puts(string1);

but that 2nd call of puts results in a segfault. I thought strcpy only copies. wtf is going on? I couldn't recreate it though on its own so I think it must be this project.

If you guys have nothing to do, maybe you can have a look.
http://pastebin.ca/1915922
It's part of a larger project but this one here reads two lines of text from a given file and separates the tokens that are separated by commas and spaces.

Name: Anonymous 2010-08-12 14:53

>>4
Wait, I mean that last strcpy.

puts(b);
strcpy(string1, someotherstring2);
puts(b);

that second puts(b) fails for some reason.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List