Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
A

ashukasama

@ashukasama
About
Posts
33
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • STL map in UNIX
    A ashukasama

    yesh i resloved the issue. it is due to file is generated by windows so it contain /r/n so now i created file in unix system , now it resolved my issue. but how we handle such situation

    C / C++ / MFC algorithms help c++ linux

  • STL map in UNIX
    A ashukasama

    Above code is working, But this code is not working

    //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;
    string tokenizeReturnFirst(const string& str,const char& delimiters)
    {
    string token;

    // skip delimiters at beginning.
    string::size\_type lastPos = str.find\_first\_not\_of(delimiters, 0);
    
    // find first "non-delimiter".
    string::size\_type pos = str.find\_first\_of(delimiters, lastPos);
    if( pos!=string::npos)
    {
        token = str.substr(lastPos, pos - lastPos);
    }
    else
    {
        token = str;
    }
    
    
    return token;
    

    }

    int main()
    {
    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;
    ifstream ifile( "test.bat");
    if ( ifile.fail() )
    {
    fprintf(stderr, "Cannot open %s\n", "output_file");
    return 0;
    }

    while (!ifile.eof())
    {
        string data\_string ;
        getline(ifile,data\_string);
        string command = tokenizeReturnFirst(data\_string,string::value\_type(' '));
        //std::transform( command.begin(), command.end(), command.begin(), ::tolower );
        cout<<"Searched string - "<<command <<endl;
        m1\_AcIter   = m1.find(command);
        if(!command.empty())        
        {
            if(m1\_AcIter  == m1.end())
            {
                cout<<"Didn't find unix command - "<< data\_string<<endl ;
            }
            else
            { 
                cout<<"SYSTEM - "<< data\_string.c\_str()<<endl;
                system(data\_string.c\_str());
            }
        }
    }
    
    C / C++ / MFC algorithms help c++ linux

  • STL map in UNIX
    A ashukasama

    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 cd =>; 0 dir =>; 0 echo =>; 0 help =>; 0 pwd =>; 0 quit =>; 0 but same code is working perfectly with windows.

    C / C++ / MFC algorithms help c++ linux

  • From C++ Windows Forms
    A ashukasama

    use ShowDialog

    C / C++ / MFC c++ winforms tutorial question

  • Transferring arrays from C++ library to C# application
    A ashukasama

    http://msdn2.microsoft.com/en-us/library/ek1fb3c6.aspx[^]

    C# csharp c++ data-structures help announcement

  • OnMouseMove Flags
    A ashukasama

    nFlags Indicates whether various virtual keys are down. This parameter can be any combination of the following values: MK_CONTROL Set if the CTRL key is down. MK_LBUTTON Set if the left mouse button is down. MK_MBUTTON Set if the middle mouse button is down. MK_RBUTTON Set if the right mouse button is down. MK_SHIFT Set if the SHIFT key is down.

    C / C++ / MFC question

  • ON_COMMAND_EX
    A ashukasama

    have a look http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=514836&SiteID=1 http://www.codeguru.com/forum/showthread.php?t=61254 http://www.codeguru.com/forum/showthread.php?t=216400 :)

    C / C++ / MFC architecture question

  • Creating ODBC Driver ( Link and good article Needed )
    A ashukasama

    Hi Guys, we have our own database and API. which is used by many application. we have some ODBC SQl interface to support odbc driver to export data in Excel and any application. I am able to understand the complte functionlity, but i am not much aware how OS will recognise odbc driver (may be using function ) i want some good article and good link on creating odbc driver with eg if possible thanks Guys

    C / C++ / MFC database json

  • How to retrieve font size of a dialog box??
    A ashukasama

    CFont* font = pWnd->GetFont(); if (font) { LOGFONT lf; font->GetLogFont(&lf); } :)

    C / C++ / MFC help tutorial question

  • How to retrieve font size of a dialog box??
    A ashukasama

    CFont* fn = GetdlgItem(ID of static :)Box)->GetFont( ) :)

    C / C++ / MFC help tutorial question

  • Process ID from Thread
    A ashukasama

    GetProcessIdOfThread(OpenThread( THREAD_ALL_ACCESS ,false ,thread id)) :) :)

    C / C++ / MFC help question

  • Taskbarnotifier
    A ashukasama

    have a look http://www.codeguru.com/Cpp/controls/statusbar/article.php/c5937/ Ashish K

    C / C++ / MFC help c++ tutorial

  • How to egalise two strings
    A ashukasama

    s1 is CString then can use CompareNoCase Compare

    C / C++ / MFC help tutorial

  • how To make a mdi form? [modified]
    A ashukasama

    dear what you need is not clear ,:confused: because ur subject says you want to "make a mdi form?":sigh: please elaborate in more detail. :)

    C# css tutorial question

  • Enable/Disable Menuitems of MdiParent from MdiChild
    A ashukasama

    you are welcome :)

    C# help question

  • how To make a mdi form? [modified]
    A ashukasama

    make yo:)ur child as a IsMdiContainer as true , it will become mdi child Ashish Kasma

    C# css tutorial question

  • Enable/Disable Menuitems of MdiParent from MdiChild
    A ashukasama

    where you launch it frmSignOn frm = new frmSignOn(); frm. MdiParent = this; frm.Show(); and at the time of private void frmSignOn_Load(object sender, System.EventArgs e) { frmMain fM = (frmMain)this.MdiParent; fM.menuItem1.Enabled = false; } :)

    C# help question

  • Enable/Disable Menuitems of MdiParent from MdiChild
    A ashukasama

    yeah dear :) Ashu Ashish Kasama

    C# help question

  • Enable/Disable Menuitems of MdiParent from MdiChild
    A ashukasama

    use this.Parent Form2 fr2 = (Form2)this.Parent; and make menuItem1 public but better approach is to make function in MDI parent to enable and disable menu item and call function in child using fr2. :)

    C# help question

  • user's current wallpaper
    A ashukasama

    Microsoft.Win32 is used for accessing the registry, while System.Runtime.InteropServices is used for accessing the unmanaged user32.dll. Next comes the preparation of the unmanaged function SystemParametersInfo() - this should be located at the top of the:) class definition: [DllImport("user32.dll", CharSet = CharSet.Auto)] static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); First thing is to retrieve the current desktop wallpaper, and to do that we don't need to use a function, but simply read a value in the Windows registry. Let's create the method for that: private string GetCurrentWallpaper() { // The current wallpaper path is stored in the registry at HKEY_CURRENT_USER\\Control Panel\\Desktop\\WallPaper RegistryKey rkWallPaper = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", false); string WallpaperPath = rkWallPaper.GetValue("WallPaper").ToString(); rkWallPaper.Close(); // Return the current wallpaper path return WallpaperPath; } Next comes the definition of the method that actually sets the wallpaper, Additional for you . And it's only a few lines of code: private void SetWallpaper(string WallpaperLocation, int WallpaperStyle, int TileWallpaper) { // Sets the actual wallpaper SystemParametersInfo(20, 0, WallpaperLocation, 0x01 | 0x02); // Set the wallpaper style to streched (can be changed to tile, center, maintain aspect ratio, etc. RegistryKey rkWallPaper = Registry.CurrentUser.OpenSubKey("Control Panel\\Desktop", true); // Sets the wallpaper style rkWallPaper.SetValue("WallpaperStyle", WallpaperStyle); // Whether or not this wallpaper will be displayed as a tile rkWallPaper.SetValue("TileWallpaper", TileWallpaper); rkWallPaper.Close(); } :)

    C# question graphics json
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups