Problem with System::IO::Directory::CreateDirectory()

C

Chad

I am receiving the following two errors in the code below. Both are
on Line 56.

error C2039: 'CreateDirectoryA' : is not a member of
'System::IO::Directory'

error C2660: 'CreateDirectoryA' : function does not take 1 arguments

Could anyone please point me in thr right direction?

Thanks!

----------------------------------------------------------
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
#include "main.h"

int main() {

bool endlessLoop = true;

// Drive G: should be mapped to \\Dri-sql-mail2\G_share
String* strOldPath = "g:\\DRI\\scanner\\FinalPoliciesTemp";
String* strNewPath =
"g:\\inetpub\\wwwroot\\Documents\\Completed Deeds & Docs";

// Program will run indefinitely
while(endlessLoop) {

// load a string array with a list of all of the
directories
String* strDirectoryEntries[] =
Directory::GetFileSystemEntries(strOldPath);

// loop through that array and move each directory
for(int i=0;i<strDirectoryEntries->Length;i++) {

// The current time plus five minutes
DateTime dtNow = DateTime::Now;
dtNow = dtNow.AddMinutes(5.0);

// The time the file was last modified
DateTime dtThisFile =
File::GetLastWriteTime(strDirectoryEntries);

// if the file's Last Modified time is greater
than the current time (plus 5 minutes)
// then we move the file.
if (DateTime::Compare(dtNow, dtThisFile) >= 0)
{

// Grab the order number from the full
path.
String* strBeginningOfOrderNumber =
"\\";
String* strEndOfOrderNumber = ".";
String* strOrderNumber =
strDirectoryEntries->Substring(strDirectoryEntries->LastIndexOf(strBeginningOfOrderNumber)+1,((strDirectoryEntries->Length)-(strDirectoryEntries->LastIndexOf(strEndOfOrderNumber)+1)));

// Grab the filename from the full
path.
String* strFileName =
String::Concat(strOrderNumber,".tiff");

String* strTempNewPath =
String::Concat(strNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);

// if the directory does NOT exist,
then create it
if(!Directory::Exists(strTempNewPath))
{


Directory::CreateDirectory(strTempNewPath);
}

strTempNewPath =
String::Concat(strTempNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);

// move the file

File::Move(strDirectoryEntries,strTempNewPath);

}

Console::WriteLine(String::Concat(strDirectoryEntries," moved!"));
}
Console::WriteLine("*** Do NOT close this Window!
***");

// Wait 3 minutes before next iteration
// 3m = 180s = 180,000ms
Sleep(180000);
}
return 0;
}
 
A

Artie Gold

Chad said:
I am receiving the following two errors in the code below. Both are
on Line 56.

error C2039: 'CreateDirectoryA' : is not a member of
'System::IO::Directory'

error C2660: 'CreateDirectoryA' : function does not take 1 arguments

Could anyone please point me in thr right direction?

Sure. Since your problem here platform specific (standard C++ knows
nothing of directories, etc.) asking in a MicroSoft forum (or checking
MSDN) would be appropriate.

You're welcome.

HTH,
--ag
----------------------------------------------------------
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
#include "main.h"

int main() {

bool endlessLoop = true;

// Drive G: should be mapped to \\Dri-sql-mail2\G_share
String* strOldPath = "g:\\DRI\\scanner\\FinalPoliciesTemp";
String* strNewPath =
"g:\\inetpub\\wwwroot\\Documents\\Completed Deeds & Docs";

// Program will run indefinitely
while(endlessLoop) {

// load a string array with a list of all of the
directories
String* strDirectoryEntries[] =
Directory::GetFileSystemEntries(strOldPath);

// loop through that array and move each directory
for(int i=0;i<strDirectoryEntries->Length;i++) {

// The current time plus five minutes
DateTime dtNow = DateTime::Now;
dtNow = dtNow.AddMinutes(5.0);

// The time the file was last modified
DateTime dtThisFile =
File::GetLastWriteTime(strDirectoryEntries);

// if the file's Last Modified time is greater
than the current time (plus 5 minutes)
// then we move the file.
if (DateTime::Compare(dtNow, dtThisFile) >= 0)
{

// Grab the order number from the full
path.
String* strBeginningOfOrderNumber =
"\\";
String* strEndOfOrderNumber = ".";
String* strOrderNumber =
strDirectoryEntries->Substring(strDirectoryEntries->LastIndexOf(strBeginningOfOrderNumber)+1,((strDirectoryEntries->Length)-(strDirectoryEntries->LastIndexOf(strEndOfOrderNumber)+1)));

// Grab the filename from the full
path.
String* strFileName =
String::Concat(strOrderNumber,".tiff");

String* strTempNewPath =
String::Concat(strNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);

// if the directory does NOT exist,
then create it
if(!Directory::Exists(strTempNewPath))
{


Directory::CreateDirectory(strTempNewPath);
}

strTempNewPath =
String::Concat(strTempNewPath,"\\");
strTempNewPath =
String::Concat(strTempNewPath,strOrderNumber);

// move the file

File::Move(strDirectoryEntries,strTempNewPath);

}

Console::WriteLine(String::Concat(strDirectoryEntries," moved!"));
}
Console::WriteLine("*** Do NOT close this Window!
***");

// Wait 3 minutes before next iteration
// 3m = 180s = 180,000ms
Sleep(180000);
}
return 0;
}
 
J

Jonathan Turkanis

Chad said:
I am receiving the following two errors in the code below. Both are
on Line 56.

error C2039: 'CreateDirectoryA' : is not a member of
'System::IO::Directory'

error C2660: 'CreateDirectoryA' : function does not take 1 arguments

Could anyone please point me in thr right direction?

Yes:

--------> microsoft.public.*

Jonathan
 
J

Jack Klein

Sure. Since your problem here platform specific (standard C++ knows
nothing of directories, etc.) asking in a MicroSoft forum (or checking
MSDN) would be appropriate.

You're welcome.

HTH,
--ag

[snip]

And snipping the remaining 92 lines of off-topic code would be
appropriate as well.
 
A

Artie Gold

Jack said:
Chad said:
I am receiving the following two errors in the code below. Both are
on Line 56.

error C2039: 'CreateDirectoryA' : is not a member of
'System::IO::Directory'
[snip]

Sure. Since your problem here platform specific (standard C++ knows
nothing of directories, etc.) asking in a MicroSoft forum (or checking
MSDN) would be appropriate.

You're welcome.
[snip]

And snipping the remaining 92 lines of off-topic code would be
appropriate as well.
Mea cul...

--ag
 
C

Chad

I am receiving the following two errors in the code below. Both are
on Line 56.

error C2039: 'CreateDirectoryA' : is not a member of
'System::IO::Directory'

error C2660: 'CreateDirectoryA' : function does not take 1 arguments

Could anyone please point me in thr right direction?

Thanks!

----------------------------------------------------------
#include <windows.h>
#using <mscorlib.dll>
using namespace System;
using namespace System::IO;
#include "main.h"
<snip>


I fixed the problem by adding #undef CreateDirectory immediately after
#include <windows.h>

- Chad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,562
Members
45,038
Latest member
OrderProperKetocapsules

Latest Threads

Top