|
-
January 19th, 2009, 08:12 AM
#1
CreateFile Help KimTu please
I'd like to get CreateFile handle when I open a volume "C:\\" but I always get -1
I test this in C++ I get 0xffffffff
Can someone shed a light on this for me please ?
Thanks 
Kim Tu
-
January 19th, 2009, 11:17 AM
#2
Re: CreateFile Help KimTu please
That's because it's a directory and not a file...
Darwen.
-
January 19th, 2009, 11:40 AM
#3
Re: CreateFile Help KimTu please
0xffffffff is the same value as -1 for Int32.
-
January 20th, 2009, 04:51 AM
#4
Re: CreateFile Help KimTu please
Negative numbers are represented in 2's complement. The rule is like this: Represent the absolute value in binary then invert all bits then add 1.
-1 = 0000 0000 0000 0000 0000 0000 0000 0001
then invert
1111 1111 1111 1111 1111 1111 1111 1110
then add 1
1111 1111 1111 1111 1111 1111 1111 1111
and that is 0xffffffff.
-
January 20th, 2009, 06:29 AM
#5
Re: CreateFile Help KimTu please
good hint Cilu on 2's complement
Please rate my post if it was helpful for you.  Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
-
January 21st, 2009, 10:39 AM
#6
Re: CreateFile Help KimTu please
Try this:
namespace CSCreateFile
{
class Program
{
static void Main(string[] args)
{
string filePath, fileName;
filePath = "D:\\testDirectory\\";
fileName = filePath + "test.txt";
Directory.CreateDirectory(filePath);
File.Create(fileName);
}
}
}
-Ricky
-
January 21st, 2009, 09:47 PM
#7
Re: CreateFile Help KimTu please
It is @"\\.\C:" not @"C:\"
Enjoy coding!
-
January 22nd, 2009, 04:35 PM
#8
Re: CreateFile Help KimTu please
Please rate my post if it was helpful for you.  Java, C#, C++, PHP, ASP.NET
SQL Server, MySQL
DirectX
MATH Touraj Ebrahimi
[toraj_e] [at] [yahoo] [dot] [com]
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
|