TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: LEON VARGHESE
from: SADOVNIKOV SERGEY
date: 1997-06-07 01:08:00
subject: String manipulation

 ‘ã¡ ˆî­ 07 1997, 01:08. I'm sitting, programming and thinking: let's write 
to Leon.
  Wrote.
‘p¤ ˆî­ 04 1997 08:36, Leon Varghese wrote ª All:
 LV> I have a string:
 LV> "a:\cpp\filename.cdm" and I want to change its file extension
 LV> so it reads  "a:\cpp\filename.trk"
 LV> I have made an attempt (which I won't post here) which is
 LV> really messy. I am hoping that someone can figure out an
 LV> easier way.
 #include 
 #include 
.......
 void ChangeExt(char * NewName,char * OldName,char * NewExt)
 {
    static char Drive[MAX_DRIVE],Dir[MAX_DIR],Name[MAX_NAME],OldExt[MAX_EXT];
    fnsplit(OldName,Drive,Dir,Name,OldExt);
    fnmerge(NewName,Drive,Dir,Name,NewExt);
 }
.............
   In this example:
     NewName -- buffer for new file name (with new extension)
     OldName -- buffer with source file name
     NewExt -- new extension for file
   I wrote constants MAX_DRIVE, MAX_DIR, MAX_NAME, MAX_EXT by memory. Look 
into helps for this constants (if complier detect errors). Example testing on 
Borland (Turbo) C/C++.
                                                           Commander Wolf
   If translator does not find bugs in programm, call to system programmer,
                     hi will find bugs in translator.
--- 2.50+
---------------
* Origin: *) Commander Wolf (* Moscow, Russia (2:5020/760.14)

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™.