Click here to Skip to main content
15,880,967 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: how to get text(caption) associated with IDs in MFC dialog based application? Pin
Purish Dwivedi13-Apr-09 20:26
Purish Dwivedi13-Apr-09 20:26 
AnswerRe: how to get text(caption) associated with IDs in MFC dialog based application? Pin
Divyang Mithaiwala13-Apr-09 20:47
Divyang Mithaiwala13-Apr-09 20:47 
GeneralRe: how to get text(caption) associated with IDs in MFC dialog based application? Pin
Purish Dwivedi13-Apr-09 20:52
Purish Dwivedi13-Apr-09 20:52 
QuestionRe: how to get text(caption) associated with IDs in MFC dialog based application? Pin
Purish Dwivedi13-Apr-09 23:35
Purish Dwivedi13-Apr-09 23:35 
GeneralRe: how to get text(caption) associated with IDs in MFC dialog based application? Pin
Divyang Mithaiwala14-Apr-09 0:24
Divyang Mithaiwala14-Apr-09 0:24 
QuestionRe: how to get text(caption) associated with IDs in MFC dialog based application? Pin
David Crow14-Apr-09 3:17
David Crow14-Apr-09 3:17 
QuestionUpdate data in CEDB using C++ and win32 APIs Pin
vijaywithu13-Apr-09 19:00
vijaywithu13-Apr-09 19:00 
QuestionC++ win32 console copy files problems Pin
h2_goh13-Apr-09 17:44
h2_goh13-Apr-09 17:44 
I am writing the simple copy files console.
And i am getting the error:
error C2664: 'CreateFileA' : cannot convert parameter 1 from 'std::basic_string<elem,_traits,_ax>' to 'LPCSTR'

#include <windows.h>
#include <iostream>
#include <string>

using namespace std;
const int BUF_SIZE = 1024;

int main(int argc, char *argv[])
{
HANDLE fileIn, fileOut;
char buf[BUF_SIZE];

DWORD nread,nwrote;
string folder1 = "C:\\firstFolder\\";
string folder2 = "C:\\secondFolder\\";

string folder[] = {folder1, folder2};
int count=0;

for (int i = 0; i < 2; i++)
{
// copy files
if ((fileIn = CreateFile("1.doc", GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening source: " << GetLastError() << endl;
}

if ((fileOut = CreateFile(folder[i] + "new.doc", GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening destination: " << GetLastError() << endl;
}
while (ReadFile(fileIn, buf, BUF_SIZE,&nread, NULL) && nread > 0) {
if ( ! WriteFile(fileOut, buf, nread,&nwrote, NULL)) {
cerr << "Error copy" << GetLastError() << endl;
}
}
CloseHandle(fileIn);
CloseHandle(fileOut);

// copy files
if ((fileIn = CreateFile("2.doc", GENERIC_READ,0, 0, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening source: " << GetLastError() << endl;
}

if ((fileOut = CreateFile(folder[i] + "new2.doc", GENERIC_WRITE,0, 0, CREATE_NEW, 0, 0)) == INVALID_HANDLE_VALUE) {
cerr << "Error opening destination: " << GetLastError() << endl;
}
while (ReadFile(fileIn, buf, BUF_SIZE,&nread, NULL) && nread > 0) {
if ( ! WriteFile(fileOut, buf, nread,&nwrote, NULL)) {
cerr << "Error copy" << GetLastError() << endl;
}
}
CloseHandle(fileIn);
CloseHandle(fileOut);
}
return 0;
}

Does any one know how to solve the error?
Pls show me a example code if possible, thanks.
AnswerRe: C++ win32 console copy files problems Pin
flyxie13-Apr-09 19:08
flyxie13-Apr-09 19:08 
GeneralRe: C++ win32 console copy files problems Pin
h2_goh13-Apr-09 20:36
h2_goh13-Apr-09 20:36 
GeneralRe: C++ win32 console copy files problems Pin
flyxie13-Apr-09 20:51
flyxie13-Apr-09 20:51 
AnswerRe: C++ win32 console copy files problems Pin
KarstenK13-Apr-09 21:40
mveKarstenK13-Apr-09 21:40 
GeneralRe: C++ win32 console copy files problems Pin
Iain Clarke, Warrior Programmer14-Apr-09 3:52
Iain Clarke, Warrior Programmer14-Apr-09 3:52 
QuestionHelp with a simple phone book program Pin
Subrina Bisnauth13-Apr-09 13:20
Subrina Bisnauth13-Apr-09 13:20 
AnswerRe: Help with a simple phone book program Pin
David Crow13-Apr-09 15:42
David Crow13-Apr-09 15:42 
QuestionC++ Socket/Multithread Programming Question Pin
djcouture13-Apr-09 9:18
djcouture13-Apr-09 9:18 
AnswerRe: C++ Socket/Multithread Programming Question Pin
bulg13-Apr-09 12:05
bulg13-Apr-09 12:05 
GeneralRe: C++ Socket/Multithread Programming Question Pin
djcouture14-Apr-09 3:29
djcouture14-Apr-09 3:29 
GeneralRe: C++ Socket/Multithread Programming Question Pin
bulg14-Apr-09 7:32
bulg14-Apr-09 7:32 
GeneralRe: C++ Socket/Multithread Programming Question Pin
djcouture15-Apr-09 5:27
djcouture15-Apr-09 5:27 
QuestionInternet to USB application Pin
2buck5613-Apr-09 9:17
2buck5613-Apr-09 9:17 
AnswerRe: Internet to USB application Pin
bulg13-Apr-09 12:08
bulg13-Apr-09 12:08 
GeneralRe: Internet to USB application Pin
2buck5613-Apr-09 13:04
2buck5613-Apr-09 13:04 
QuestionMore specific question, help please Pin
bulg13-Apr-09 14:32
bulg13-Apr-09 14:32 
AnswerRe: More specific question, help please Pin
2buck5613-Apr-09 15:58
2buck5613-Apr-09 15:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.