-
December 27th, 2002, 08:34 PM
#1
CreateFile and Long Path/Files :: Win32
Hi.
Is it possible to create a file with a long path name? For example:
Code:
std::string pathFile("c:\testing\December 27\newfile.type");
// CreateFile fails
if (::CreateFile(pathFile->c_str(),...) == INVALID_HANDLE_VALUE)
{
}
I would like to know two properties of CreateFile(). First, is it possible to create a file in a directory that does not exist via CreateFile()? In the example above, directories "testing" and "December 27" do not exist.
Secondly, is it possible to create directories with spaces between one or more words, i.e. December 27. Notice the space before "2."
Thanks,
Kuphryn
-
December 27th, 2002, 08:39 PM
#2
You must create the path if it does not exist. CreateFILE does exactly what it states.
There is no problem with long filenames or even names with spaces.
Hope this helps....
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 27th, 2002, 08:41 PM
#3
-
December 28th, 2002, 01:26 PM
#4
Re: CreateFile and Long Path/Files :: Win32
Originally posted by kuphryn
Code:
std::string pathFile("c:\testing\December 27\newfile.type");
Assuming that the directories exist, if you have problems with this, then it is because you need to use the following instead:
Code:
std::string pathFile("c:\\testing\\December 27\\newfile.type");
-
December 28th, 2002, 02:24 PM
#5
Slapping myself silly...Didnt notice the single back slashes, not cuaght since the next character in the string is a valid escapped character (but illegal in a filename of course!).
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
May 29th, 2014, 02:23 AM
#6
Re: CreateFile and Long Path/Files :: Win32
You may use Long Path Tool for this purpose. Its sure to sort out your problem.
-
May 29th, 2014, 02:33 AM
#7
Re: CreateFile and Long Path/Files :: Win32
Originally Posted by adamenko
You may use Long Path Tool for this purpose. Its sure to sort out your problem.
No, there is not necessary a special tool to create such "long" path files as shown in the OP.
Besides, note this topic is 12 years old.
Please, do not resuscitate old threads!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|