>> char *src[size+1] = "\0000544D.TIF";
That's an array of 14 char* - you probably want to drop the pointer.
>> Now you have me worried as to what I am missing or have missed.
If the string is a literal, then you'd need "\\" to represent a single "\", but that only applies to what the compiler "sees", not a string read from the user, a file, etc. At any rate, all that isn't necessary (I didn't compile this, but it should work fine):
Code:
char* remove_char( char* str, char fmt )
{
char
* cpy,
* pos;
for( pos = cpy = str; *pos; ++pos )
if( *pos != fmt )
*cpy++ = *pos;
*cpy = 0;
return str;
}
Or using indexes, instead:
Code:
char* remove_char( char* str, char fmt )
{
int
cpy,
pos;
for( pos = cpy = 0; str[ pos ]; ++pos )
if( str[ pos ] != fmt )
str[ cpy++ ] = str[ pos ];
str[ cpy ] = 0;
return str;
}
Example:
Code:
int main( void )
{
char*
buf[ 1024 ] = "\0000544D.TIF";
puts( remove_char( buf, '\\' ) );
return 0;
}
Of course it strips all of the chars from the text, but a similar approach could be used to remove only the first one, if desired.