Is there something out there that would allow me to take a substring of a character not a string? My character is a path name and I need to take the substring of the drive letter (i.e. C:\) only!
This is a discussion on character substring within the C++ Programming forums, part of the General Programming Boards category; Is there something out there that would allow me to take a substring of a character not a string? My ...
Is there something out there that would allow me to take a substring of a character not a string? My character is a path name and I need to take the substring of the drive letter (i.e. C:\) only!
my post was lost....any suggestions!!!!!!
Gee, that sounds like a routine you could write yourself!
I mean, golly gosh! since the string you have is just an array of characters, at the very least you could smatter together a routine like this (not how I would do it)--
Code:int main(void); void getdrivestring(char*,char*); int main(void) { char driveString[4]; /* just enough to hold device letter */ char path[] = "C:/Windows/System"; getdrivestring(path,driveString); /* parse out the letter */ return(0); } void getdrivestring(char *a,char *b) { int i; for(i=0;i<3;i++) b[i] = a[i]; /* copy first 3 letters */ b[3] = 0x00; /* length terminating byte */ }
seems rather brute-force, yet it would do the trick, eh?
PROBLEMS ALL RESOLVED...THANKS FOR SUGGESTIONS!