473,383 Members | 1,853 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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

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[i]);

// 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[i]->Substring(strDirectoryEntries[i]->LastIndexOf(strBeginningOfOrderNumber)+1,((strDir ectoryEntries[i]->Length)-(strDirectoryEntries[i]->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[i],strTempNewPath);

}

Console::WriteLine(String::Concat(strDirectoryEntr ies[i]," moved!"));
}
Console::WriteLine("*** Do NOT close this Window!
***");

// Wait 3 minutes before next iteration
// 3m = 180s = 180,000ms
Sleep(180000);
}
return 0;
}
Jul 22 '05 #1
6 9221
Chad wrote:
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.
Thanks!
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[i]);

// 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[i]->Substring(strDirectoryEntries[i]->LastIndexOf(strBeginningOfOrderNumber)+1,((strDir ectoryEntries[i]->Length)-(strDirectoryEntries[i]->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[i],strTempNewPath);

}

Console::WriteLine(String::Concat(strDirectoryEntr ies[i]," moved!"));
}
Console::WriteLine("*** Do NOT close this Window!
***");

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

--
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays
Jul 22 '05 #2
Chad wrote:
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
Jul 22 '05 #3
On Mon, 17 Jan 2005 20:37:59 -0700, "Jonathan Turkanis"
<te******@kangaroologic.com> wrote:
Chad wrote:
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

I hear an echo... :)
Jul 22 '05 #4
On Mon, 17 Jan 2005 21:24:23 -0600, Artie Gold
<ar*******@austin.rr.com> wrote in comp.lang.c++:
Chad wrote:
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.

Thanks!


You're welcome.

HTH,
--ag


[snip]

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

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Jul 22 '05 #5
Jack Klein wrote:
On Mon, 17 Jan 2005 21:24:23 -0600, Artie Gold
<ar*******@austin.rr.com> wrote in comp.lang.c++:

Chad wrote:
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.
Thanks!


You're welcome.

[snip]

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

Mea cul...

--ag

--
Artie Gold -- Austin, Texas
http://it-matters.blogspot.com (new post 12/5)
http://www.cafepress.com/goldsays
Jul 22 '05 #6
On Mon, 17 Jan 2005 20:54:31 -0600, Chad <ch********@gmail.com> wrote:
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
Jul 22 '05 #7

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

Similar topics

7
by: Eran Kampf | last post by:
I am trying to dynamically create directories in my ASP.NET application (I am using Server.MapPath("/")+"test" as the folder) and I am getting a DirectoryNotFoundException saying "Could not find a...
1
by: H.B. | last post by:
Hi, Is there a way to avoid conflicts between CreateDirectory() (from API) and Directory::CreateDirectory(). The other functions from Directory class works(Exists() as example). It seems to be...
5
by: Philip Wagenaar | last post by:
I have a Windows Form application that monitors a directory using the System.IO.FileSystemWatcher. On the event created I run a sub that sends an xml file over http to a service. When I copy...
0
by: NewbieDev | last post by:
Hi, I call Directory.CreateDirectory and File.Copy from VB.NET with a UNC path that has a dollar sign ($) - "\\servername\foldername$\childfoldername\" and it gives me this error message: ...
2
by: mr t | last post by:
I have a website set up this way... http://localhost <- project root. http://localhost/Files <- vir dir (not application. just vir dir) with write permissions. 1. Start VS.NET 2005 debugging....
0
by: Matt MacDonald | last post by:
Hi all, I'm having a really frustrating problem. I have a web application that needs to modify the directory structure of the underlying files. The problem I'm having is that after the system...
4
by: Tom | last post by:
This is really weird, but I have the following code: private static readonly string mString = "tempUnzipDir" + Path.DirectorySeparatorChar; .... public static string...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.