Stop Microsoft

Miscellaneous => Programming & Networking => Topic started by: Stryker on 1 July 2003, 14:00

Title: quick C question
Post by: Stryker on 1 July 2003, 14:00
I'm having a problem with this:

Code: [Select]

It gives the output:

Code: [Select]

I think there is a problem with my while statement. I did it with for just fine, I'm just thinking I can do it with while too.

I probably look stupid, but I'm trying to brush up on some C skills.

[ July 01, 2003: Message edited by: Stryker ]

Title: quick C question
Post by: Stryker on 1 July 2003, 14:10
bah, nm i was being stupid. it's 2am though. what do you expect?

You can't program at 2am without pizza and beer.
Title: quick C question
Post by: suselinux on 1 July 2003, 14:18
you can't do anything at 2am without pizza and beer
Title: quick C question
Post by: solo on 2 July 2003, 10:34
Actually, I find ET to be extremely easy even without beer and pizza... however, I need vast amounts of drugs at 2 am in the morning
Title: quick C question
Post by: jtpenrod on 3 July 2003, 14:05
quote:
while (x=0,x!=argc,x++)
The commas are the problem: these should be semi's.
____________________________________
Live Free or Die: Linux
(http://www.otakupc.com/etsig/dolphin.gif)
"There: now you'll never have to look at those dirty Windows anymore"
      --Daffy Duck
Title: quick C question
Post by: Stryker on 3 July 2003, 14:22
quote:
Originally posted by jtpenrod:
The commas are the problem: these should be semi's.


That's correct for the for() function. I figured it all out, I was using while() way wrong. Now to figure out how to take some chars out of a string and use them.

char *buf1="abcdefg";
how do we make buf2="cdef"?
Title: quick C question
Post by: flap on 3 July 2003, 19:36
strncpy(buf2, buf1 + 2, 4);