TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: LEON VARGHESE
from: CAMERON CLARK
date: 1997-06-08 19:27:00
subject: Re: String manipulation

LV> "a:\cpp\filename.cdm" and I want to change its file extension
LV> so it reads  "a:\cpp\filename.trk"
    You can assume (dos & win3.x) that the string will only have
    one period in it. Then you can do the following.
         find the position of the period
         make sure there are 3 chars following the period
         replace .XXX with .YYY
    const char *strchr(const char *s, int c);                    // C++ only
    strchr scans a string in the forward direction, looking for a specific
    character. strchr finds the first occurrence of the character c in the
    string s.  The null-terminator is considered to be part of the string.
    size_t strlen(const char *s);
    strlen returns the number of characters in s, not counting the 
    null-terminating character.
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)838-8237 (1:3811/350)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.