Click here to Skip to main content
15,894,720 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to redirect WriteFile func writes to console Pin
leon de boer21-Feb-18 7:12
leon de boer21-Feb-18 7:12 
GeneralRe: How to redirect WriteFile func writes to console Pin
Łukasz Gęsieniec21-Feb-18 19:57
Łukasz Gęsieniec21-Feb-18 19:57 
GeneralRe: How to redirect WriteFile func writes to console Pin
leon de boer22-Feb-18 14:19
leon de boer22-Feb-18 14:19 
GeneralRe: How to redirect WriteFile func writes to console Pin
Łukasz Gęsieniec22-Feb-18 19:50
Łukasz Gęsieniec22-Feb-18 19:50 
GeneralRe: How to redirect WriteFile func writes to console Pin
Peter_in_278022-Feb-18 20:21
professionalPeter_in_278022-Feb-18 20:21 
GeneralRe: How to redirect WriteFile func writes to console Pin
leon de boer22-Feb-18 21:06
leon de boer22-Feb-18 21:06 
Questionproblem defining a function inside a structure in c Pin
Member 1367832014-Feb-18 5:40
Member 1367832014-Feb-18 5:40 
AnswerRe: problem defining a function inside a structure in c Pin
David Crow14-Feb-18 6:09
David Crow14-Feb-18 6:09 
AnswerRe: problem defining a function inside a structure in c Pin
CPallini14-Feb-18 10:44
mveCPallini14-Feb-18 10:44 
Questionsetting Boundary condition X^2-Y^2 for solving Laplace equation for NxN grid. Pin
Member 1362564310-Feb-18 17:23
Member 1362564310-Feb-18 17:23 
AnswerRe: setting Boundary condition X^2-Y^2 for solving Laplace equation for NxN grid. Pin
Victor Nijegorodov10-Feb-18 23:07
Victor Nijegorodov10-Feb-18 23:07 
QuestionDefault Stack Size Pin
ForNow10-Feb-18 17:02
ForNow10-Feb-18 17:02 
AnswerRe: Default Stack Size Pin
Richard MacCutchan10-Feb-18 21:23
mveRichard MacCutchan10-Feb-18 21:23 
GeneralRe: Default Stack Size Pin
ForNow11-Feb-18 3:55
ForNow11-Feb-18 3:55 
GeneralRe: Default Stack Size Pin
Richard MacCutchan11-Feb-18 6:32
mveRichard MacCutchan11-Feb-18 6:32 
GeneralRe: Default Stack Size Pin
ForNow11-Feb-18 6:48
ForNow11-Feb-18 6:48 
GeneralRe: Default Stack Size Pin
Richard MacCutchan11-Feb-18 7:10
mveRichard MacCutchan11-Feb-18 7:10 
GeneralRe: Default Stack Size Pin
ForNow11-Feb-18 7:13
ForNow11-Feb-18 7:13 
Questionsmoothing issue Pin
Member 1367132810-Feb-18 1:59
Member 1367132810-Feb-18 1:59 
AnswerRe: smoothing issue Pin
phil.o10-Feb-18 4:57
professionalphil.o10-Feb-18 4:57 
GeneralRe: smoothing issue Pin
Member 1367132810-Feb-18 5:04
Member 1367132810-Feb-18 5:04 
QuestionHow do we cast void type Pin
luplup9-Feb-18 14:46
luplup9-Feb-18 14:46 
Hello,
I got problem trying converting type when the var is declared void in function.
How do you do these things !? for example casting short to int from void var (declared short at start)
And can we change a variable type without having to create new var !?

4 days im on, and i dont get solution without rewriting 50 "identical" functions just with changed type...
It's for that im looking to the void type.
Please help Smile | :)

C++
#include <stdio.h>

void calc(void *var) {
	//try convert short to int with new var
	int tmp = *(int*)var;
	printf("tmp: %i\n", tmp);//bad, must be 30002
	//try cast/convert original var
	*(int*)var += 30003;
}

void complexeShortToInt() {
	short int vInt2 = 30002;
	calc(&vInt2);
	printf("complexeShortToInt: %i\n", vInt2);//bad, must be 60005
}

/*void simpleShortToInt() {
	short int vInt = 30000;
	int vOut = (int)vInt;
	vOut += 30000;
	printf("simpleShortToInt: %i\n", vOut);//good
}*/

int main() {
	//simpleShortToInt();//good
	complexeShortToInt();//bad
	return 0;
}

AnswerRe: How do we cast void type Pin
Richard MacCutchan9-Feb-18 21:49
mveRichard MacCutchan9-Feb-18 21:49 
GeneralRe: How do we cast void type Pin
luplup10-Feb-18 7:15
luplup10-Feb-18 7:15 
GeneralRe: How do we cast void type Pin
Richard MacCutchan10-Feb-18 9:54
mveRichard MacCutchan10-Feb-18 9:54 

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.