Archive for the 'C/C++' Category

Please visit: http://aimslife.com/blog/?p=27


Please visit: http://aimslife.com/blog/?p=23


Please visit: http://aimslife.com/blog/?p=20


Please visit: http://aimslife.com/blog/?p=6


Please visit: http://aimslife.com/blog/?p=7


Please visit: http://aimslife.com/blog/?p=18


Given code can help you to compute checksum.
/* pseudo header for checksum calculation */ typedef struct pseudoh {     guint32 src_addr;     guint32 dest_addr;     guint8  zero;     guint8  protocol;     guint16 [...]


This setting will enables for you to control automatic rebooting of the system after the crash. After the crash, you must be able to check the reason of the crash and for that, the system should not reboot. Therefore, it is very necessary to control the automatic rebooting of the system.
Path:  [...]


While working on Microsoft Device Driver domain, I found following most active and helpful forums,
1) OSR-Online: http://www.osronline.com You can configure OSR-Online forum on email client and given client will be helpful for you. http://www.osronline.com/page.cfm?name=NewsReaderInfo
2) Microsoft NNTP Server: msnews.microsoft.com Following groups [...]


I faced given compilation error after convert “Komodia Project” from “VC6” to “VS2K5”.
Error    1    Command line error D8004 : ‘/D’ requires an argument    cl

Solution:
Remove “/D” from “Additional options” (Example image is given below). Path of “Additional options” is “Project Properties” >> “Configuration Properties” >> “C/C++” >> “Command Line”


Please visit: http://aimslife.com/blog/?p=11


Please visit: http://aimslife.com/blog/?p=9


Please visit: http://aimslife.com/blog/?p=10


Today, I am sharing one of the informative information for craze engineers. ‘Taking Help from the right place‘ is difficult job know days cause of million of million site available on internet. So, how we can evaluate web site in a short time? this is difficult for me to answer it, but I know one [...]


Creation of DLL task in visual studio 2005 is so simple. Follow the following steps to make DLL in visual studio 2005.
Make new project via using menu or press “Ctrl+Shift+N”.

Select Win32 from Project types and select “Win32 Console Application” project template.

Give project name which you want, select location of project where [...]


#include <iostream>
using namespace std;
template <int Size>
class NInt
{
private:
int Int:Size;
public:
int GetValue();
void SetValue(int value);
void PrintValue();
};
template <int Size>
int NInt<Size>::GetValue()
{
return this->Int;
}
template <int Size>
void NInt<Size>::SetValue(int value)
{
this->Int = value;
}
template <int Size>
void NInt<Size>::PrintValue()
{
cout<<”Value : “<<this->Int<<endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
NInt<2> obj;
obj.PrintValue();
obj.SetValue(1);
[...]


How To Use Greta?
[Visit Link] http://www29.websamba.com/sswater/en/greta/index.htm


GRETA:
The GRETA Regular Expression Template Archive

GRETA gives you all the power of Perl 5 regular expressions in your C++
applications. These easy-to-use classes let you perform regular
expression pattern matches on strings in C++.

Features include:

Fast backtracking regular expression engine.
Separately compiled patterns.
Matches against C-style NULL-terminated strings, C++-sytle std::string’s, or iterator ranges.
Template on iterator type and syntax module.
Supports [...]


#include
#include
#include
#include
int DeleteDirectory(const std::string &refcstrRootDirectory,
                    bool              bDeleteSubdirectories = true)
{
  bool            bSubdirectory = false;       // Flag, indicating whether
                                               // subdirectories have been found
  HANDLE          hFile;                       // Handle to directory
  std::string     strFilePath;                 // Filepath
  std::string     strPattern;                  // Pattern
  WIN32_FIND_DATA FileInformation;             // File information
  strPattern = refcstrRootDirectory + “\\*.*”;
  hFile = ::FindFirstFile(strPattern.c_str(), &FileInformation);
  if(hFile != INVALID_HANDLE_VALUE)
  {
    [...]


Make sure you call CoInitialize(NULL); before calling this function.
// CreateLink – uses the Shell’s IShellLink and IPersistFile interfaces
//   to create and store a shortcut to the specified object.
// Returns the result of calling the member functions of the interfaces.
// lpszPathObj – address of a buffer containing the path of the [...]


#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[]){  char ptr[ ] = ”123abcdabeabf”;  int count, start, end, up, move, endIndex;  count = 1;  start = end = up = 0;  move = 1;  endIndex = strlen( ptr ) + 1;  while( start <= endIndex )  {    while( move <= endIndex )    {      if( ptr[ up ] == ptr[ move ] )      {        end = up;        if( ptr[ up + 1 ] != ptr[ move + 1 ] )        {          count ++;        }        up ++;      }      else if( ptr[ up ] != ptr[ move ] )        up = start;      move ++;    }    if( count > 1 )    cout<<”string: ”<<ptr<<endl      <<”count : ”<<count<<endl      <<”start : ”<<start<<endl      <<”end   : ”<<end<<endl      <<”up    : ”<<up<<endl;    up = start = end = end + 1;    count = 1;    move = end + 2;  }  cout<<”—>END OF LINE<—”<<endIndex<<endl;  _gettch( );  return 0;}
OUTPUT:——-string: 123abcdabeabfcount : 3start : 3end   : 4up    : 3string: 123abcdabeabfcount : 2start : 7end   : 8up    : 7—>END OF LINE<—14
Suggest it, how to make it correct?


If you wants to makes toolbar with out using MFC IDE. MFC IDE is too much ugly and helpless to make toolbar using high resolution bitmap. For this Purpose you needs following line to write in .rc file
IDR_RCTOOLBAR           BITMAP                  “res\\LargeIcons.bmp”
IDR_RCTOOLBAR TOOLBAR  32, 32BEGIN  BUTTON     ID_NEW  BUTTON     ID_OPEN  BUTTON     ID_SAVE  BUTTON     ID_PAST  BUTTON     ID_SEARCH  BUTTON     ID_PRINT  [...]


streaming fun

19Dec06

enjoy streaming example in C++
#include “stdafx.h”#include <iostream>#include <fstream> using namespace std; int _tmain(int argc, _TCHAR* argv[]){    ofstream file( “rdbuf.txt” );    streambuf *x = cout.rdbuf( file.rdbuf( ) );    for( int i = 0; i < 20; i ++ )        cout << “test” << endl; // Goes to file     cout.rdbuf(x);    cout << “test2″ << [...]