Click here to Skip to main content
15,922,584 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Dialog handle of Dialog-based application Pin
rp_suman23-Jul-07 19:07
rp_suman23-Jul-07 19:07 
AnswerRe: Dialog handle of Dialog-based application Pin
Hamid_RT31-Jul-07 20:07
Hamid_RT31-Jul-07 20:07 
QuestionDirectshow linking errors - VC++ Pin
techratna23-Jul-07 16:57
techratna23-Jul-07 16:57 
AnswerRe: Directshow linking errors - VC++ Pin
Mark Salsbery23-Jul-07 18:59
Mark Salsbery23-Jul-07 18:59 
QuestionChild frame and multiple view problem Pin
oro7723-Jul-07 14:58
oro7723-Jul-07 14:58 
AnswerRe: Child frame and multiple view problem Pin
Mark Salsbery23-Jul-07 16:23
Mark Salsbery23-Jul-07 16:23 
GeneralRe: Child frame and multiple view problem Pin
oro7724-Jul-07 14:39
oro7724-Jul-07 14:39 
Questionlogin Pin
dellthinker23-Jul-07 14:46
dellthinker23-Jul-07 14:46 
Hi all. Im going to try my best to explain what i need here.

I need a function to return true if a certain parameter is entered in, based on the true i need other function to call on this function to make sure its ok to proceed, if false is returned then dont do anything, if true is returned then go ahead and execute. I made a simple prog using a boolean to return true.

<br />
#include <iostream><br />
#include <string><br />
using namespace std;<br />
bool password(const char* pass);<br />
<br />
<br />
string input;<br />
int main(){<br />
	cout << "Please enter password: ";<br />
	cin >> input;<br />
	password(input.c_str());<br />
	system("pause");<br />
	return 0;<br />
}<br />
<br />
bool password(const char* pass){<br />
	string password="stupidpass";<br />
	if(password == input){<br />
		cout << "Password correct! " << endl;<br />
		return true;<br />
	}<br />
	else<br />
	{<br />
		cout << "Password incorrect! " << endl;<br />
		return false;<br />
	}<br />
}<br />


It works perfectly. Now what it is im trying to do is compare the strings from password and the sock buffer. So i tried the following ...


<br />
bool checklogin(const char* login);<br />
<br />
	if(servbuff.find(login) != string::npos){<br />
		if(servbuff.find(auth) != string::npos){<br />
			checklogin(servbuff.c_str());<br />
		}<br />
		else{<br />
			error();<br />
		}<br />
	}<br />
<br />
bool checklogin(const char* login){ <br />
	if(password == servbuff){<br />
	cout << "Login correct " << endl;<br />
		return true;<br />
	}<br />
	else{<br />
	cout << "Login incorrect " << endl;<br />
		return false;<br />
           }<br />
}<br />


And it kept saying incorrect, i know that it is because the string isnt matching correctly. What im trying to figure out how would i go about calling the function with the parameter that will send what it needs to match the two strings. If im unclear about something let me know and i'll try to be more specific. Thanx in advance!
AnswerRe: login Pin
Mark Salsbery23-Jul-07 16:31
Mark Salsbery23-Jul-07 16:31 
Questiontime difference in seconds between myTime and ZeroTime Pin
beriho23-Jul-07 9:57
beriho23-Jul-07 9:57 
AnswerRe: time difference in seconds between myTime and ZeroTime Pin
David Crow23-Jul-07 10:54
David Crow23-Jul-07 10:54 
GeneralRe: time difference in seconds between myTime and ZeroTime [modified] Pin
beriho23-Jul-07 11:07
beriho23-Jul-07 11:07 
GeneralRe: time difference in seconds between myTime and ZeroTime Pin
David Crow24-Jul-07 2:47
David Crow24-Jul-07 2:47 
AnswerRe: time difference in seconds between myTime and ZeroTime Pin
DevMentor.org23-Jul-07 11:43
DevMentor.org23-Jul-07 11:43 
Questionmultiple request,response using sockets ? Pin
jalsa G23-Jul-07 8:42
jalsa G23-Jul-07 8:42 
AnswerRe: multiple request,response using sockets ? Pin
led mike23-Jul-07 9:19
led mike23-Jul-07 9:19 
JokeRe: multiple request,response using sockets ? Pin
Randor 23-Jul-07 11:05
professional Randor 23-Jul-07 11:05 
GeneralRe: multiple request,response using sockets ? Pin
Mark Salsbery23-Jul-07 11:33
Mark Salsbery23-Jul-07 11:33 
GeneralRe: multiple request,response using sockets ? Pin
led mike23-Jul-07 12:10
led mike23-Jul-07 12:10 
Questionerase cookies cookie from webbrowser control Pin
awah23-Jul-07 8:28
awah23-Jul-07 8:28 
QuestionRe: erase cookies cookie from webbrowser control Pin
David Crow23-Jul-07 8:55
David Crow23-Jul-07 8:55 
AnswerRe: erase cookies cookie from webbrowser control Pin
awah23-Jul-07 9:17
awah23-Jul-07 9:17 
GeneralRe: erase cookies cookie from webbrowser control Pin
led mike23-Jul-07 9:23
led mike23-Jul-07 9:23 
QuestionFile Sharing between two projects... Pin
Super Hornet23-Jul-07 5:51
Super Hornet23-Jul-07 5:51 
AnswerRe: File Sharing between two projects... Pin
Hans Dietrich23-Jul-07 7:45
mentorHans Dietrich23-Jul-07 7:45 

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.