Click here to Skip to main content
15,899,679 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: Sharing some humour Pin
Randor 2-Nov-16 17:34
professional Randor 2-Nov-16 17:34 
GeneralRe: Sharing some humour Pin
leon de boer2-Nov-16 18:57
leon de boer2-Nov-16 18:57 
AnswerRe: Sharing some humour Pin
Daniel Pfeffer2-Nov-16 22:23
professionalDaniel Pfeffer2-Nov-16 22:23 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 3:14
leon de boer3-Nov-16 3:14 
GeneralRe: Sharing some humour Pin
Daniel Pfeffer3-Nov-16 3:34
professionalDaniel Pfeffer3-Nov-16 3:34 
GeneralRe: Sharing some humour Pin
leon de boer3-Nov-16 4:41
leon de boer3-Nov-16 4:41 
GeneralRe: Sharing some humour Pin
Randor 13-Nov-16 5:43
professional Randor 13-Nov-16 5:43 
QuestionSendMessage for Interprocess communication stops working Pin
ForNow1-Nov-16 15:29
ForNow1-Nov-16 15:29 
AnswerRe: SendMessage for Interprocess communication stops working Pin
Midi_Mick1-Nov-16 16:16
professionalMidi_Mick1-Nov-16 16:16 
GeneralRe: SendMessage for Interprocess communication stops working Pin
ForNow1-Nov-16 16:22
ForNow1-Nov-16 16:22 
GeneralRe: SendMessage for Interprocess communication stops working Pin
Midi_Mick1-Nov-16 17:36
professionalMidi_Mick1-Nov-16 17:36 
AnswerRe: SendMessage for Interprocess communication stops working Pin
Randor 1-Nov-16 17:56
professional Randor 1-Nov-16 17:56 
GeneralRe: SendMessage for Interprocess communication stops working Pin
ForNow2-Nov-16 13:59
ForNow2-Nov-16 13:59 
GeneralRe: SendMessage for Interprocess communication stops working Pin
Randor 2-Nov-16 16:42
professional Randor 2-Nov-16 16:42 
AnswerRe: SendMessage for Interprocess communication stops working Pin
leon de boer2-Nov-16 3:10
leon de boer2-Nov-16 3:10 
GeneralRe: SendMessage for Interprocess communication stops working Pin
ForNow2-Nov-16 14:32
ForNow2-Nov-16 14:32 
GeneralRe: SendMessage for Interprocess communication stops working Pin
leon de boer2-Nov-16 16:57
leon de boer2-Nov-16 16:57 
QuestionNeed help with cryptography Pin
SMD1111-Nov-16 8:54
SMD1111-Nov-16 8:54 
AnswerRe: Need help with cryptography Pin
Randor 1-Nov-16 19:04
professional Randor 1-Nov-16 19:04 
Question[C]Problem in creating a random string Pin
xXxRevolutionxXx27-Oct-16 1:31
xXxRevolutionxXx27-Oct-16 1:31 
Hello ! I just started to play around with C lately(and mainly with pointers). For practice, i created this function that is suppose to create a random string:

C
char *ReturnRandomString(int Range)
{
	
	char StringsToChooseFrom[26] = {'q','w','e','r','t','y','u','i','o','p','a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m'};
	char MyArray[Range + 1];
	char *Ptr_str;
	int i;
    
    for(i = 0; i < Range; i++)
	{
	    srand(time(NULL));
	    int RandomInt = rand() & 26;
	
	    MyArray[i] = StringsToChooseFrom[RandomInt -1];
	}
	MyArray[i + 1] = '\0';
	
	Ptr_str = malloc(sizeof(MyArray));
	Ptr_str = MyArray;
	return(Ptr_str);
}


I am "calling" this function this way:

C
char *PtrCharArray = ReturnRandomString(5);
		printf("\nString Array returned: %s", PtrCharArray);


The output... is nothing. I don't neither an output on the console... either an error.
It's sure that i am missing something, but i don't know what. Thanks in advance !!!

P.S No hate.
AnswerRe: [C]Problem in creating a random string Pin
Richard MacCutchan27-Oct-16 1:46
mveRichard MacCutchan27-Oct-16 1:46 
GeneralRe: [C]Problem in creating a random string Pin
k505427-Oct-16 4:47
mvek505427-Oct-16 4:47 
GeneralRe: [C]Problem in creating a random string Pin
Richard MacCutchan27-Oct-16 4:55
mveRichard MacCutchan27-Oct-16 4:55 
AnswerRe: [C]Problem in creating a random string Pin
Jochen Arndt27-Oct-16 2:35
professionalJochen Arndt27-Oct-16 2:35 
AnswerRe: [C]Problem in creating a random string Pin
leon de boer27-Oct-16 3:43
leon de boer27-Oct-16 3:43 

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.