newbie: instr, mid, right, etc. in c?

Started by
14 comments, last by ELS1 22 years, 3 months ago
im just learning c...and im having trouble with string formating. is there any built in c functions that all you to do this? as you can see, i come from the VB world :D Any help or pointers will be appreciated!
Advertisement
  int i = 2;char string[] = "hello";char dst[256];sprintf(dst, "This is an int %i, This is a string %s", i, string);Dst will now contain  "This is an int 2 this is a string hello"  


--------------------------

Those who dance are considered insane by those who cannot hear the music.
Those who dance are considered insane by those who cannot hear the music.
There''s not an equivilant to instr (that im aware of), but you could
easily write a function that would be equivilant..
just break it down into parts and return the correct value, pretty simple...
same thing with right, left, mid, ect...

-eldee
;another space monkey;
-eldee;another space monkey;[ Forced Evolution Studios ]
thanks!
instr in C is strstr
Go to the bookstore. Look at the books on C.
Find one that shows how to do nearly every built-in function.
Buy the book. Look up what you want in the string section.
Have a nice day.
quote:Original post by Anonymous Poster
Go to the bookstore. Look at the books on C.
Find one that shows how to do nearly every built-in function.
Buy the book. Look up what you want in the string section.
Have a nice day.


im sorry...but your sarcastic remarks make you sound like an a55hole :D
Actually, C++: The Complete Reference Third Edition does a pretty good job of it. It separates everything C from the added C++ stuff too so you''ll only get the C part if that''s what you want.

No, HTML is not an OO language.
I was the ap a55hole. (Another reason to keep ap posting!)

And now that I've read my post, by the end
I think you can go ahead and replace the 5's with s's and
tack on another modifier if you so desire.

So what about masonium, he suggests the same thing.
Actually, my advice is better because he just tells you
what to buy, my advice gives you more range and more
importantly, you can use the book later. My advice also
will lead to a more deeper understanding as the alternative
to my advice is to write them yourself and learn more about
how computers work. Sob...Sob...All I try to do is help
and this is the thanks I get??!! LOUD CRYING

Anyway, what was sarcastic about my remarks, aren't we
programmers? Aren't you?

Although I suppose my post was a bad one, you came here to
find advice because you couldn't come up with the idea to
either buy a book or look it up on an online reference and
I was too lazy to hand the functions to you and told you
to do something for yourself. Shame on me. Bad Boy! (Smack!)

I'm so glad the internet came along, my family says I've
got a big mouth and will one day get the tar beaten out of
me and they just might be right.

Certainly don't let my remarks get to ya, I've looked at your
profile and other posts you've made and you seem to be doing
some pretty nice projects.

Sound 'like' an a55hole, whatever happened to my gift?

Create.
Liv Tyler makes a really great elf.

Edited by - RolandofGilead on January 1, 2002 2:56:43 AM
sorry...i was kinda pissed because my cousins are over my house and they are getting on my last nerve! NOW GIVE ME A HUG lol

This topic is closed to new replies.

Advertisement