Article View: comp.std.c
Article #4781Re: How to replace space in a file name?
From: Mike Bourdaa
Date: Thu, 22 Feb 1996 09:24
Date: Thu, 22 Feb 1996 09:24
29 lines
1353 bytes
1353 bytes
> Dear C expert, > > I got a small program and appreciate your help: > > How to replace a file name include space inbetween to _ > or how to delete this kind of file with a small C program? > I'm assuming you're using unix (since dos doesn't allow spaces in filenames and macs don't have any problem getting rid of these files) One thing, if you just want to get rid of the file, here's a unix trick. Say I have a file called foo bar.tar I can type mv foo\ bar.tar foo_bar.tar the \ allows you to escape out difficult characters like a space, or a - as the first character (ever try to remove a file called "-r" ;-) ) But as far as a C program.. basically I'd just take in a filename, scan it with a *char, and replace all occurances of ' ' with '_' Shouldn't be too hard. Mike Bourdaa
Technical Details
Message-ID:
<Pine.LNX.3.91.960222011900.236A-100000@s195_13.resnet.ucla.edu>Path:
arc1-ca.pugleaf.net!s195_13.resnet.ucla.edu!rootReferences:
<4gfki6$6sn@mn5.swip.net>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!s195_13.resnet.ucla.edu!root From: Mike Bourdaa <root@s195_13.resnet.ucla.edu> Newsgroups: comp.std.c Subject: Re: How to replace space in a file name? Date: Thu, 22 Feb 1996 01:24:14 -0800 Organization: University of California, Los Angeles Message-ID: <Pine.LNX.3.91.960222011900.236A-100000@s195_13.resnet.ucla.edu> References: <4gfki6$6sn@mn5.swip.net> NNTP-Posting-Host: s195_13.resnet.ucla.edu Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <4gfki6$6sn@mn5.swip.net>