stupid C question
Roger Oberholtzer
roger.oberholtzer
Mon May 17 11:47:19 PDT 2004
Try 'man basename', or:
char offset_filename[MAX]:
strcat(offset_filename, basename(argv[1]));
strcat(offset_filename,".offset");
On Wed, 14 May 2003 14:33:12 -0400
Douglas J Hunley <doug at hunley.homeip.net> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> $DEITY it's been forever since I mucked with C...
>
> if I have:
> char offset_filename[MAX};
> <blah>
> strcat(offset_filename,argv[1]);
> strcat(offset_filename,".offset");
>
> and I call the program like:
> a /some/path/to/file
>
> then offset_filename becomes /some/path/to/file.offset
>
> how in the $PURGATORY do I modify that code to replace /some/path/to
> with /my/hardcoded/path/to so that calling the program like:
> a /some/path/to/file
>
> ends up with offset_filename being:
> /my/hardcoded/path/to/file.offset
>
> (note that 'file' is still pulled from the argv[1])
--
Roger Oberholtzer
Sunny Stockholm
More information about the Linux-users
mailing list