Click here to Skip to main content
15,898,374 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Calling Unmanaged Class From DLL Pin
İsmail Durmaz5-Sep-09 5:43
İsmail Durmaz5-Sep-09 5:43 
GeneralRe: Calling Unmanaged Class From DLL Pin
Joe Woodbury5-Sep-09 8:39
professionalJoe Woodbury5-Sep-09 8:39 
AnswerRe: Calling Unmanaged Class From DLL Pin
Hristo-Bojilov5-Sep-09 7:55
Hristo-Bojilov5-Sep-09 7:55 
GeneralRe: Calling Unmanaged Class From DLL Pin
Joe Woodbury5-Sep-09 8:48
professionalJoe Woodbury5-Sep-09 8:48 
AnswerRe: Calling Unmanaged Class From DLL Pin
Joe Woodbury5-Sep-09 8:55
professionalJoe Woodbury5-Sep-09 8:55 
GeneralRe: Calling Unmanaged Class From DLL Pin
İsmail Durmaz6-Sep-09 3:12
İsmail Durmaz6-Sep-09 3:12 
GeneralRe: Calling Unmanaged Class From DLL Pin
Joe Woodbury6-Sep-09 7:36
professionalJoe Woodbury6-Sep-09 7:36 
QuestionSTL map in UNIX Pin
ashukasama4-Sep-09 23:24
ashukasama4-Sep-09 23:24 
I want to write shell programming in UNIX, alao i am new to unix. i have written very simple program for console

ISSUE:
I added some item in map as string int pair, now i am searching string read from commandline and i am unable to find it, but if i use same code with windows . i am able to do same.


Code is as follows

//Inclue files for libraries
#include <stdlib.h>
#include <ctype.h>
#include <iostream>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <ctime> 
#include <string>
#include <stdio.h>
#include <map>
#include <algorithm>

using namespace std;

map <string, int> m1;

int main(int argc, char* argv[])
{
	m1.insert(map <string, int> :: const_iterator::value_type("cd",0));		
	m1.insert(map <string, int> :: const_iterator::value_type("dir",0));		
	m1.insert(map <string, int> :: const_iterator::value_type("pwd",0));		
	m1.insert(map <string, int> :: const_iterator::value_type("echo",0));		
	m1.insert(map <string, int> :: const_iterator::value_type("help",0));		
	m1.insert(map <string, int> :: const_iterator::value_type("quit",0));		
	map <string, int> :: const_iterator m1_AcIter, m1_RcIter;
	typedef pair <string, int> Int_Pair;

	if(argc == 1)
	{
		cout<<"Please enter unix command..";
	}
	else
	{
		string command;
		command =  argv[1];            
		map <string, int> :: const_iterator m1_AcIter, m1_RcIter;
		m1_AcIter   = m1.find(command);
		if(m1_AcIter  == m1.end())
		{
			cout<<"Didn't find unix command - "<< command<<endl ;
		}
		else
		{ 
			system(command.c_str());
		}

	}
	
	map <string, int> :: iterator it;
	for ( it=m1.begin() ; it != m1.end(); it++ )
		cout << (*it).first << " => " << (*it).second << endl;
	
	return 0;

}


now i am running this code

./a.out ls

and i received following output

Didn't find unix command - ls<br />
cd =>; 0<br />
dir =>; 0<br />
echo =>; 0<br />
help =>; 0<br />
pwd =>; 0<br />
quit =>; 0 


but same code is working perfectly with windows.
AnswerRe: STL map in UNIX Pin
Richard MacCutchan4-Sep-09 23:36
mveRichard MacCutchan4-Sep-09 23:36 
GeneralRe: STL map in UNIX Pin
ashukasama4-Sep-09 23:53
ashukasama4-Sep-09 23:53 
GeneralRe: STL map in UNIX Pin
Stuart Dootson4-Sep-09 23:59
professionalStuart Dootson4-Sep-09 23:59 
GeneralRe: STL map in UNIX Pin
Stuart Dootson5-Sep-09 0:02
professionalStuart Dootson5-Sep-09 0:02 
GeneralRe: STL map in UNIX Pin
Richard MacCutchan5-Sep-09 0:43
mveRichard MacCutchan5-Sep-09 0:43 
GeneralRe: STL map in UNIX Pin
ashukasama5-Sep-09 0:47
ashukasama5-Sep-09 0:47 
GeneralRe: STL map in UNIX Pin
Stuart Dootson5-Sep-09 6:13
professionalStuart Dootson5-Sep-09 6:13 
AnswerRe: STL map in UNIX Pin
Stuart Dootson4-Sep-09 23:54
professionalStuart Dootson4-Sep-09 23:54 
QuestionCListBox Pin
thanhvinh09064-Sep-09 17:46
thanhvinh09064-Sep-09 17:46 
AnswerRe: CListBox Pin
Code-o-mat5-Sep-09 8:42
Code-o-mat5-Sep-09 8:42 
QuestionC++ Queue Pin
jonig194-Sep-09 15:00
jonig194-Sep-09 15:00 
AnswerRe: C++ Queue Pin
Joe Woodbury4-Sep-09 19:05
professionalJoe Woodbury4-Sep-09 19:05 
AnswerRe: C++ Queue Pin
N a v a n e e t h4-Sep-09 20:35
N a v a n e e t h4-Sep-09 20:35 
AnswerRe: C++ Queue Pin
«_Superman_»4-Sep-09 22:47
professional«_Superman_»4-Sep-09 22:47 
AnswerRe: C++ Queue Pin
Stuart Dootson5-Sep-09 0:12
professionalStuart Dootson5-Sep-09 0:12 
QuestionHow to get number of the "CMDIChildWnd" initialized? Pin
transoft4-Sep-09 12:31
transoft4-Sep-09 12:31 
AnswerRe: How to get number of the "CMDIChildWnd" initialized? Pin
Randor 4-Sep-09 13:55
professional Randor 4-Sep-09 13:55 

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.