Friday, October 14, 2011

Simple Multithreading Application sample source code in pure C

In our general program we can’t run two process at same time for e.g we can’t run two for loop at same time.For running two process at same time we need Multithreading.In C we do it by the _beginthread and
_endthread run time  library function.All the above c run time library functions are in the process.h header file.

Header
process.h

Prototype

unsigned long _beginthread(void(* func)(void*), unsigned stack_size, void *arg);

Description

Thursday, October 13, 2011

Generate random number in C++

Random number is generated by using srand(time(NULL)) and rand() function.For time we have to include time.h and for srand() and rand function we have to include stdlib.h.Here is the simple program which generate 10 random number.
#include<iostream>
#include<time.h>
#include<stdlib.h>
#define MAX_NUM 10
using namespace std;

Tuesday, October 11, 2011

Conversion of infix operation to postfix and simple calculator

This code is to convert infix operation to postfix operation .This is the application of stack.Example infix  8*5+(5-3+1) converted to 85*53-1++ and result is 43.This program can be use as a simple calculator where user can calculate any result only in single step.
Copy the code and compile it in codeblock.

Monday, October 10, 2011

Winsock Programming sample project cyber management system.

 Cyber Management System is a program which interconnects different computers which allows users to communicate over the computer network and provide security from unauthorized users by login system in client server.
The project is based on the client server architecture and its communication protocols. The project basically is divided into two sections:- Cyber server and Client server. Not only a single, multiple client can connect to cyber server at any time. Cyber server has the full control over Client server. Client server is password protected user has to login to access internet and other services. New user can signup for username and password. Price rate and services is fixed by cyber server. Client can request any service sending message to cyber server.

Major component


socket API

syntax:
int socket( int domain , inttype , intprotoco ) ;

Scanning pdf file in hard drive or folder source code in c++

This program use the batch processing.For batch processing we use Frofiles.exe command.
Syntax
FORFILES [/p Path] [/m Mask] [/s] [/c Command] [/d [+ | -] {dd/MM/yyyy | dd}]   

Parameter List:
    /P    pathname      Indicates the path to start searching.
                        The default folder is the current working directory (.).


    /M    searchmask    Searches files according to a searchmask. The default searchmask is '*' .

    /S                  Instructs forfiles to recurse into subdirectories. Like "DIR /S".

    /C    command       Indicates the command to execute for each file.
                        Command strings should be wrapped in double quotes.

                        The default command is "cmd /c echo @file".


Sunday, October 9, 2011

Playing sound source code in C++

This source code is not for playing songs or sound clips from your hard drive only to play  sound by using windows function Beep(int dwFreq [in],int dwDuration [in]) .
Parameters are
dwFreq [in] 
                    The frequency of the sound, in hertz. This parameter must be in the range 37 through 32,767                      (0x25 through 0x7FFF)
 dwDuration [in]
                       The duration of the sound, in milliseconds.
If the function succeeds, the return value is nonzero.If the function fails, the return value is zero. To get extended error information, call GetLastError.
This source code play the music “twinkle twinkle little star” using windows command Beep.Here is the source code copy it and compile and run in code::blocks IDE.