Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: filenames with spaces

Reply
Thread Tools

Re: filenames with spaces

 
 
Francesco S. Carta
Guest
Posts: n/a
 
      08-30-2010
Paul <(E-Mail Removed)>, on 30/08/2010 17:06:53, wrote:

> Hello everyone!
> I am creating a utility program that loops through a directory and
> removes files using the c++ remove() function.
> Now the problem is SOME files contain spaces in their names
> ie: Lance Armstrong-JTM-020837.jpg
> So how can i escape the names so remove() will work correctly.


The std::remove algorithm has nothing to do with your problem.

Post your code and point out exactly what the issue is. With the amount
of information you have given it takes a lucky wild guesser or a genius
to give you a sensible answer - and I am neither of these

--
FSC - http://userscripts.org/scripts/show/59948
http://fscode.altervista.org - http://sardinias.com
 
Reply With Quote
 
 
 
 
Francesco S. Carta
Guest
Posts: n/a
 
      08-30-2010
Sherm Pendley <(E-Mail Removed)>, on 30/08/2010 13:21:13, wrote:

> "Francesco S. Carta"<(E-Mail Removed)> writes:
>
>> Paul<(E-Mail Removed)>, on 30/08/2010 17:06:53, wrote:
>>
>>> Hello everyone!
>>> I am creating a utility program that loops through a directory and
>>> removes files using the c++ remove() function.
>>> Now the problem is SOME files contain spaces in their names
>>> ie: Lance Armstrong-JTM-020837.jpg
>>> So how can i escape the names so remove() will work correctly.

>>
>> The std::remove algorithm has nothing to do with your problem.

>
> Then why bring it up?
>
>> Post your code and point out exactly what the issue is. With the
>> amount of information you have given it takes a lucky wild guesser or
>> a genius

>
> ... or someone who's also familiar with C functions, and isn't afraid
> to call them from C++.


Ouch... I just forgot there is a remove() function that deletes files in
the C heritage... OK, never mind, thanks for the reminder

--
FSC - http://userscripts.org/scripts/show/59948
http://fscode.altervista.org - http://sardinias.com
 
Reply With Quote
 
 
 
 
Jorgen Grahn
Guest
Posts: n/a
 
      08-31-2010
On Mon, 2010-08-30, Francesco S. Carta wrote:
> Sherm Pendley <(E-Mail Removed)>, on 30/08/2010 13:21:13, wrote:
>
>> "Francesco S. Carta"<(E-Mail Removed)> writes:
>>
>>> Paul<(E-Mail Removed)>, on 30/08/2010 17:06:53, wrote:
>>>
>>>> Hello everyone!
>>>> I am creating a utility program that loops through a directory and
>>>> removes files using the c++ remove() function.
>>>> Now the problem is SOME files contain spaces in their names
>>>> ie: Lance Armstrong-JTM-020837.jpg
>>>> So how can i escape the names so remove() will work correctly.
>>>
>>> The std::remove algorithm has nothing to do with your problem.

>>
>> Then why bring it up?
>>
>>> Post your code and point out exactly what the issue is. With the
>>> amount of information you have given it takes a lucky wild guesser or
>>> a genius

>>
>> ... or someone who's also familiar with C functions, and isn't afraid
>> to call them from C++.

>
> Ouch... I just forgot there is a remove() function that deletes files in
> the C heritage... OK, never mind, thanks for the reminder


It was complete news for me too, even though it has been in C since
C89 at least!

I think many of us go "oh, that area isn't well covered by the
standard library" and immediately reach for the OS-specific functions.
In this case, I'd have used Unix's unlink(2).

/Jorgen

--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem with filenames, Filenames and FILENAMES B.J. HTML 4 04-23-2005 08:13 PM
Re: SMTP Mail Attachments: filenames with spaces don't work Scott Allen ASP .Net 3 08-23-2004 02:23 PM
Why can some browsers read filenames with spaces. Edison Carter HTML 1 09-30-2003 07:10 AM
removing spaces from front and end of filenames hokiegal99 Python 9 07-14-2003 12:38 AM
Re: removing spaces from front and end of filenames tubby tudor Python 0 07-13-2003 06:19 PM



Advertisments