problem in using SHFILEOPSTRUCT and SHFileOperation
up vote
-1
down vote
favorite
I am trying to use the SHFileOperation()
function to copy a folder from one directory to another directory.
I wrote the below code using this link: Copy a Folder.
But I get error code 0x7B, and when I searched for information about the error, this page says: "The filename, directory name, or volume label syntax is incorrect."
I wrote the filename and directory name correctly, but I don't know why this code can't copy the ty
folder from the D drive to another folder called secondfolder
on the D drive.
Sorry, I searched about this a lot in your website, but I didn't get any answer to my issue.
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
system("color 0A")
SHFILEOPSTRUCT fo;
memset(&fo, 0, sizeof(fo));
fo.hwnd = 0;
fo.wFunc = FO_COPY;
fo.pFrom = L"D:\ty\*";
fo.pTo = L"D:\secondfolder\*";
fo.fFlags = FOF_NOCONFIRMMKDIR
c++
add a comment |
up vote
-1
down vote
favorite
I am trying to use the SHFileOperation()
function to copy a folder from one directory to another directory.
I wrote the below code using this link: Copy a Folder.
But I get error code 0x7B, and when I searched for information about the error, this page says: "The filename, directory name, or volume label syntax is incorrect."
I wrote the filename and directory name correctly, but I don't know why this code can't copy the ty
folder from the D drive to another folder called secondfolder
on the D drive.
Sorry, I searched about this a lot in your website, but I didn't get any answer to my issue.
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
system("color 0A")
SHFILEOPSTRUCT fo;
memset(&fo, 0, sizeof(fo));
fo.hwnd = 0;
fo.wFunc = FO_COPY;
fo.pFrom = L"D:\ty\*";
fo.pTo = L"D:\secondfolder\*";
fo.fFlags = FOF_NOCONFIRMMKDIR
c++
@AlexF read the documentation. Extra null terminators are required onpTo
andpFrom
, as they are double null terminated lists.fo.pFrom = L"D:\ty\*"; fo.pTo = L"D:\secondfolder\";
– Remy Lebeau
Nov 11 at 6:32
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I am trying to use the SHFileOperation()
function to copy a folder from one directory to another directory.
I wrote the below code using this link: Copy a Folder.
But I get error code 0x7B, and when I searched for information about the error, this page says: "The filename, directory name, or volume label syntax is incorrect."
I wrote the filename and directory name correctly, but I don't know why this code can't copy the ty
folder from the D drive to another folder called secondfolder
on the D drive.
Sorry, I searched about this a lot in your website, but I didn't get any answer to my issue.
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
system("color 0A")
SHFILEOPSTRUCT fo;
memset(&fo, 0, sizeof(fo));
fo.hwnd = 0;
fo.wFunc = FO_COPY;
fo.pFrom = L"D:\ty\*";
fo.pTo = L"D:\secondfolder\*";
fo.fFlags = FOF_NOCONFIRMMKDIR
c++
I am trying to use the SHFileOperation()
function to copy a folder from one directory to another directory.
I wrote the below code using this link: Copy a Folder.
But I get error code 0x7B, and when I searched for information about the error, this page says: "The filename, directory name, or volume label syntax is incorrect."
I wrote the filename and directory name correctly, but I don't know why this code can't copy the ty
folder from the D drive to another folder called secondfolder
on the D drive.
Sorry, I searched about this a lot in your website, but I didn't get any answer to my issue.
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
system("color 0A")
SHFILEOPSTRUCT fo;
memset(&fo, 0, sizeof(fo));
fo.hwnd = 0;
fo.wFunc = FO_COPY;
fo.pFrom = L"D:\ty\*";
fo.pTo = L"D:\secondfolder\*";
fo.fFlags = FOF_NOCONFIRMMKDIR
c++
c++
edited Nov 11 at 6:28
Remy Lebeau
327k18246433
327k18246433
asked Nov 11 at 4:52
meysamimani
1
1
@AlexF read the documentation. Extra null terminators are required onpTo
andpFrom
, as they are double null terminated lists.fo.pFrom = L"D:\ty\*"; fo.pTo = L"D:\secondfolder\";
– Remy Lebeau
Nov 11 at 6:32
add a comment |
@AlexF read the documentation. Extra null terminators are required onpTo
andpFrom
, as they are double null terminated lists.fo.pFrom = L"D:\ty\*"; fo.pTo = L"D:\secondfolder\";
– Remy Lebeau
Nov 11 at 6:32
@AlexF read the documentation. Extra null terminators are required on
pTo
and pFrom
, as they are double null terminated lists. fo.pFrom = L"D:\ty\*"; fo.pTo = L"D:\secondfolder\";
– Remy Lebeau
Nov 11 at 6:32
@AlexF read the documentation. Extra null terminators are required on
pTo
and pFrom
, as they are double null terminated lists. fo.pFrom = L"D:\ty\*"; fo.pTo = L"D:\secondfolder\";
– Remy Lebeau
Nov 11 at 6:32
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You need to remove the *
from pTo
:
fo.pTo = L"D:\secondfolder\";
Also, you are trying to copy only the contents of ty
, not copy ty
itself. If you want that, remove the *
from pFrom
as well:
fo.pFrom = L"D:\ty\";
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You need to remove the *
from pTo
:
fo.pTo = L"D:\secondfolder\";
Also, you are trying to copy only the contents of ty
, not copy ty
itself. If you want that, remove the *
from pFrom
as well:
fo.pFrom = L"D:\ty\";
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
add a comment |
up vote
0
down vote
You need to remove the *
from pTo
:
fo.pTo = L"D:\secondfolder\";
Also, you are trying to copy only the contents of ty
, not copy ty
itself. If you want that, remove the *
from pFrom
as well:
fo.pFrom = L"D:\ty\";
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
add a comment |
up vote
0
down vote
up vote
0
down vote
You need to remove the *
from pTo
:
fo.pTo = L"D:\secondfolder\";
Also, you are trying to copy only the contents of ty
, not copy ty
itself. If you want that, remove the *
from pFrom
as well:
fo.pFrom = L"D:\ty\";
You need to remove the *
from pTo
:
fo.pTo = L"D:\secondfolder\";
Also, you are trying to copy only the contents of ty
, not copy ty
itself. If you want that, remove the *
from pFrom
as well:
fo.pFrom = L"D:\ty\";
answered Nov 11 at 6:38
Remy Lebeau
327k18246433
327k18246433
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
add a comment |
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
thank you so much dear Remy Lebeau
– meysamimani
Nov 11 at 13:45
add a comment |
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53245950%2fproblem-in-using-shfileopstruct-and-shfileoperation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
@AlexF read the documentation. Extra null terminators are required on
pTo
andpFrom
, as they are double null terminated lists.fo.pFrom = L"D:\ty\*"; fo.pTo = L"D:\secondfolder\";
– Remy Lebeau
Nov 11 at 6:32