|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
||||
|
||||
|
strlen
I havent found much online how to do this..I just want the user to type out a string and using strlen, give the user how many characters he/she typed..anyone can help real quick? Regards.
-andy
__________________
hmmm... |
|
#2
|
|||
|
|||
|
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
|
#3
|
||||
|
||||
|
Using strlen() is easy. Just pass it a string, and it returns the number of characters in the string (not including the NULL character at the end). Here's an example from MSDN:
/* STRLEN.C */ #include <string.h> #include <stdio.h> #include <conio.h> #include <dos.h> void main( void ) { char buffer[61] = "How long am I?"; int len; len = strlen( buffer ); printf( "'%s' is %d characters long\n", buffer, len ); } Where exactly are you having problems? With the user input, or with using strlen()? There are a number of ways to get user input into a string.
__________________
Jason Doucette / Xona.com™ - Programming Windows Errata Addendum "Discussion is an exchange of knowledge; argument is an exchange of ignorance." |
|
#4
|
||||
|
||||
|
Ahh...thx for the google link..i forgot to put the () at the end of the strlen in my search. I understand now guys, thanks!
-andy |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > strlen |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|