473,666 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

function _findfirst with a pathname containing a blank

Hello,
I try to check the existence of a file with the function
_findfirst(...) .
The file is located in a directory with a blank in its path name: C:
\Program Files\ExtPrg.ex e

When I run the following code:
char FilePath[]="C:\\\"Prog ram Files\"\\ExtPrg .exe";
hFile = _findfirst( FilePath, &c_file );
system (FilePath);
the _findfirst function returns -1 which means that the file is not
found, but the following system command starts the file.
So can anybody tell me, how I have to enter FilePath in a way that the
_findfirst function works?

Thank you.

Apr 25 '07 #1
3 5228
hpber wrote:
Hello,
I try to check the existence of a file with the function
_findfirst(...) .
(There's no such function in Standard C, so you're using some kind
of extension: you may get more help by appealing in a group
appropriate to your system.)
The file is located in a directory with a blank in its path name: C:
\Program Files\ExtPrg.ex e
(We hatess pathnames with ssspaces in, preciousss!)
When I run the following code:
char FilePath[]="C:\\\"Prog ram Files\"\\ExtPrg .exe";
Um. If the pathname you want is

C:\Program Files\ExtPrg.ex e

why have you coded up a pathname

C:\"Program Files"\ExtPrg.e xe

??? You've put double-quotes into your pathname using the \" escape.

--
"No-one here is exactly what he appears." G'kar, /Babylon 5/

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Apr 25 '07 #2
hpber said:
Hello,
I try to check the existence of a file with the function
_findfirst(...) .
The file is located in a directory with a blank in its path name: C:
\Program Files\ExtPrg.ex e
Try comp.os.ms-windows.program mer.win32

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Apr 25 '07 #3
hpber wrote:
Hello,
I try to check the existence of a file with the function
_findfirst(...) .
Functions prefixed with a "_", is a reminder that you are off-topic in
c.l.c.
The file is located in a directory with a blank in its path name: C:
\Program Files\ExtPrg.ex e
When I run the following code:
char FilePath[]="C:\\\"Prog ram Files\"\\ExtPrg .exe";
I prefer to write filenames with path this way:

fopen("C:/Program Files/ExtPrg.exe", "r")

aka UNIX like, but works on Win32 as well.

--
Tor
Apr 25 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1540
by: qwweeeit | last post by:
Hi all, I wonder if it is possible to change (temporarily) a built-in function for logging purposes. Let me explain: I want to log all the 'open' operations, recording the file to be opened, the "mode" (r/w/a...) and (possibly) the module which made the call. After that the 'open' can carry on following the standard built-in path. Possibly I don't want to have to modify the source of the application
3
7285
by: b1azesk | last post by:
I'm trying to write a Javascript to set a relative path for my files, s I don't have to type in an absolute path. I know that I need to someho define the root directory, likely using /, then I need to have th function check to see where the file sits, then add the appropriat ../ infront of it. Unfortunatly I'm totally stumped as to what I need to do. A ex-co-worker of mine used to have a function similar to this, howeve we've lost...
1
1696
by: Robert Oschler | last post by:
Is there a Javascript function, or library, that will take a URL and make it uniform/consistent? Something that will resolve all relative pathing and the current domain and protocol and return a uniform URL? Like the realpath() function in PHP? Thanks.
3
1782
by: Anna | last post by:
Hi. I want to write a program which does different functions according to input. I need to write it as general as possible. Example: input: Beep 2 <should call a function which does the beep (parameter = 2)*/ Funny_text 5 3 <should call a function which writes funny text (parameters: 5,3) */
2
5606
by: Fernando Barsoba | last post by:
Hi all, I'm trying to read from a binary file, and I'm using 'fread()' as indicated in function 'getfile()'. The variable 'bytesread' shows that I have read the 557,000 bytes from the file, but because the file has a 00 at the 17h position, when doing >>lenbuf2 = strlen(buf2), I get only 17 bytes. So, it's weird, because fread() seems to put 550,000 bytes in the buf variable, but after returning from the function, only bytes up to EOF...
5
8612
by: Sakharam Phapale | last post by:
Hi All, I am using an API function, which takes file path as an input. When file path contains special characters (@,#,$,%,&,^, etc), API function gives an error as "Unable to open input file". Same file path containing special characters works fine in one machine, but doesn't work in other. I am using following API function to get short file path. Declare Auto Function GetShortPathName Lib "kernel32" (ByVal lpszLongPath As
0
1094
by: drhowarddrfine | last post by:
Haven't programmed in quite a while and not sure of myself. I will be given a web page based on the pathname, ie, /page1/page2/mypage. I need to follow that pathname and execute the function called mypage(). It is used to dynamically generate web pages and, obviously, there are other pages with different names. So my thought is to examine the pathname and look it up in an array, perhaps a hashtable, to see if it exists and call it. ...
3
9151
by: Wayne | last post by:
I have a report containing 2 subreports. The subreports each contain a chart. The whole thing easily fits on one page but a second blank page is consistently being generated. This has nothing to do with the page width being too large because it isn't, and the second blank page displays the report header and footer. I can reduce the depth of the subreports so that they only take up one half of the first page's depth, but the second...
1
3878
by: faultykid | last post by:
I would like to store a variable then call it back later. I have a variable on line 198 www = ''+this._ad.clickUrl+''; and on line 321 i try document.write(www);
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.