Click here to Skip to main content
15,895,817 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionget all folder names ? Pin
sam_psycho9-Apr-09 19:02
sam_psycho9-Apr-09 19:02 
AnswerRe: get all folder names ? Pin
Jijo.Raj9-Apr-09 19:34
Jijo.Raj9-Apr-09 19:34 
AnswerRe: get all folder names ? Pin
Hamid_RT9-Apr-09 21:02
Hamid_RT9-Apr-09 21:02 
AnswerRe: get all folder names ? Pin
rwilmink19-Apr-09 21:14
rwilmink19-Apr-09 21:14 
QuestionSetup Creation with MYSQL database Pin
gopalrajatrt9-Apr-09 17:55
gopalrajatrt9-Apr-09 17:55 
QuestionCListCtrl BackColor [modified] Pin
12Code9-Apr-09 17:32
12Code9-Apr-09 17:32 
AnswerRe: CListCtrl BackColor Pin
Jijo.Raj9-Apr-09 18:59
Jijo.Raj9-Apr-09 18:59 
QuestionGetComputerName <-- Issue with string? Pin
rbwest869-Apr-09 16:53
rbwest869-Apr-09 16:53 
Hi all,

got a question thats bugging me. I can not figure out this very simple compile error I am getting. Here is the error:

C:\Documents and Settings\mininet\My Documents\C++\9APR09\test.cpp In function `int main()':
28 C:\Documents and Settings\mininet\My Documents\C++\9APR09\test.cpp expected primary-expression before "GetLocalComputerName"
28 C:\Documents and Settings\mininet\My Documents\C++\9APR09\test.cpp expected `;' before "GetLocalComputerName"

I know its related to the string. but what is wrong with it? If you tell me whats wrong, dont just tell me. Please include a description of why the string is messed up. Thank you in advance! Code is as follows:


<code>// Project 01 by Rob

#include <iostream>
#include <string>
#include <windows.h>
using namespace std;


int main()
{
system("CLS");
string password;
string GetLocalComputerName;
cout << "password: ";
cin >> password;

if (password == "123"){
system("CLS"); // Cleares the screen
cout << "password accepted" << endl;}

else{
cout << "password incorrect" << endl;
goto exit;}
exit:

system("CLS");
system("TITLE Local Computer Name");
string GetLocalComputerName()
{
TCHAR chrComputerName[MAX_COMPUTERNAME_LENGTH + 1];
string strRetVal;
DWORD dwBufferSize = MAX_COMPUTERNAME_LENGTH + 1;

if(GetComputerName(chrComputerName,&dwBufferSize)) {
strRetVal = chrComputerName;
} else {
strRetVal = "";
}

return(strRetVal);
}
//std::cin.ignore( std::numeric_limits<std::streamsize>::max(), '\y' );
return 0;
}



V/R

Rob
QuestionRe: GetComputerName &lt;-- Issue with string? Pin
David Crow9-Apr-09 17:22
David Crow9-Apr-09 17:22 
AnswerRe: GetComputerName &lt;-- Issue with string? Pin
rbwest869-Apr-09 17:49
rbwest869-Apr-09 17:49 
GeneralRe: GetComputerName &lt;-- Issue with string? Pin
David Crow10-Apr-09 2:45
David Crow10-Apr-09 2:45 
AnswerRe: GetComputerName &lt;-- Issue with string? Pin
Jijo.Raj9-Apr-09 19:10
Jijo.Raj9-Apr-09 19:10 
GeneralRe: GetComputerName &lt;-- Issue with string? Pin
rbwest869-Apr-09 20:38
rbwest869-Apr-09 20:38 
GeneralRe: GetComputerName &lt;-- Issue with string? Pin
Jijo.Raj9-Apr-09 23:28
Jijo.Raj9-Apr-09 23:28 
QuestionDealing with resource ID conflicts (MFC service Pack 2008) Pin
Maximilien9-Apr-09 10:22
Maximilien9-Apr-09 10:22 
QuestionSetupDiGetDeviceInterfaceDetail help Pin
suendisra9-Apr-09 5:54
suendisra9-Apr-09 5:54 
AnswerRe: SetupDiGetDeviceInterfaceDetail help Pin
Jerry Evans9-Apr-09 6:32
Jerry Evans9-Apr-09 6:32 
GeneralRe: SetupDiGetDeviceInterfaceDetail help Pin
suendisra9-Apr-09 19:04
suendisra9-Apr-09 19:04 
Questioncmd.exe error Pin
Max++9-Apr-09 5:49
Max++9-Apr-09 5:49 
AnswerRe: cmd.exe error Pin
David Crow9-Apr-09 6:33
David Crow9-Apr-09 6:33 
QuestionBreakpoints not being hit Pin
Like2Byte9-Apr-09 4:44
Like2Byte9-Apr-09 4:44 
AnswerRe: Breakpoints not being hit Pin
Rajesh R Subramanian9-Apr-09 5:16
professionalRajesh R Subramanian9-Apr-09 5:16 
AnswerRe: Breakpoints not being hit Pin
Iain Clarke, Warrior Programmer9-Apr-09 5:41
Iain Clarke, Warrior Programmer9-Apr-09 5:41 
GeneralRe: Breakpoints not being hit Pin
Like2Byte9-Apr-09 9:32
Like2Byte9-Apr-09 9:32 
Questionhow to control Stepper Motor Control drive through serial Port Pin
sahih9-Apr-09 4:38
sahih9-Apr-09 4:38 

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.