Click here to Skip to main content
15,915,093 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: newbie needs help Pin
George L. Jackson4-Nov-06 3:33
George L. Jackson4-Nov-06 3:33 
AnswerRe: newbie needs help Pin
Benlahrech .Dj3-Nov-06 17:09
Benlahrech .Dj3-Nov-06 17:09 
QuestionAccess control from a user defined class (Dialog based application) Pin
cy163@hotmail.com3-Nov-06 11:23
cy163@hotmail.com3-Nov-06 11:23 
AnswerRe: Access control from a user defined class (Dialog based application) Pin
Mark Salsbery3-Nov-06 12:12
Mark Salsbery3-Nov-06 12:12 
AnswerRe: Access control from a user defined class (Dialog based application) Pin
nguyenvhn3-Nov-06 15:54
nguyenvhn3-Nov-06 15:54 
QuestionString Assignment Pin
abhiramsss3-Nov-06 9:17
abhiramsss3-Nov-06 9:17 
AnswerRe: String Assignment Pin
Christian Graus3-Nov-06 9:31
protectorChristian Graus3-Nov-06 9:31 
AnswerRe: String Assignment Pin
Zac Howland3-Nov-06 10:49
Zac Howland3-Nov-06 10:49 
abhiramsss wrote:
ProcessName[0] = exeName1; //// giving error


There are 2 problems here. First, your array is an array of 2 character pointers, so when you set exeName1 to ProcessName[0], you are just setting the pointer value to point to that. The problem is that, since exeName is on the stack, it's type is char[] and not char* (slight, but important difference). Also, since it is on the stack, when it goes out of scope, that pointer is no longer valid anyway (so you would have a dangling pointer). What I believe you want to do is:

static char** ProcessName = new char*[2];
memset(ProcessName, 0, sizeof(char*) * 2);
ProcessName[0] = new char[15];
memset(ProcessName[0], 0, sizeof(char) * 15);
// NOTE:  setting the size to 50 with a buffer of 15 will cause a memory overrun
// Use the size of your array - 1 as the size
GetPrivateProfileString("AC", "exel", "", ProcessName[0], 14, "C:\\exe1.ini");


If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week

Zac

Questioncheckbox - remote application Pin
edvintas3-Nov-06 8:54
edvintas3-Nov-06 8:54 
AnswerRe: checkbox - remote application Pin
aquawicket3-Nov-06 19:28
aquawicket3-Nov-06 19:28 
GeneralRe: checkbox - remote application Pin
edvintas3-Nov-06 21:24
edvintas3-Nov-06 21:24 
QuestionMath to Message Box problem. Pin
aquawicket3-Nov-06 7:42
aquawicket3-Nov-06 7:42 
AnswerRe: Math to Message Box problem. Pin
Mark Salsbery3-Nov-06 7:47
Mark Salsbery3-Nov-06 7:47 
GeneralRe: Math to Message Box problem. Pin
aquawicket3-Nov-06 7:55
aquawicket3-Nov-06 7:55 
QuestionCFtpFileFind problems Pin
Dman83223-Nov-06 7:01
Dman83223-Nov-06 7:01 
QuestionRe: CFtpFileFind problems Pin
David Crow3-Nov-06 7:28
David Crow3-Nov-06 7:28 
AnswerRe: CFtpFileFind problems Pin
Dman83223-Nov-06 7:50
Dman83223-Nov-06 7:50 
QuestionReturn value or Exception or something else ? Pin
Mr.Brainley3-Nov-06 5:40
Mr.Brainley3-Nov-06 5:40 
AnswerRe: Return value or Exception or something else ? Pin
Waldermort3-Nov-06 5:52
Waldermort3-Nov-06 5:52 
AnswerRe: Return value or Exception or something else ? Pin
led mike3-Nov-06 6:00
led mike3-Nov-06 6:00 
GeneralRe: Return value or Exception or something else ? Pin
Mr.Brainley3-Nov-06 6:12
Mr.Brainley3-Nov-06 6:12 
GeneralRe: Return value or Exception or something else ? Pin
Mark Salsbery3-Nov-06 6:25
Mark Salsbery3-Nov-06 6:25 
GeneralRe: Return value or Exception or something else ? Pin
Mr.Brainley3-Nov-06 6:30
Mr.Brainley3-Nov-06 6:30 
GeneralRe: Return value or Exception or something else ? Pin
Mark Salsbery3-Nov-06 6:35
Mark Salsbery3-Nov-06 6:35 
GeneralRe: Return value or Exception or something else ? Pin
Mr.Brainley3-Nov-06 6:42
Mr.Brainley3-Nov-06 6:42 

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.