Writing to Files Using fwrite
Writing to Files Using fwrite
This function has the same four arguments to fread:
The first is a char * variable and is wha..more
Random Access File Handling in C
Programming Random Access File I/O in CThe basic file operations are fopen - open a file- specify how its opened (read/write) and type (binary/text) fclose - close an ope..more
Manage Memory Efficiently
Manage Memory Efficiently:
Because C++ objects are often allocated from the heap and have limited scope, memory use in C++ pro..more
#pragma pack
pack
#pragma pack( [ show ] | [ push | pop ] [, iden..more
Explain Function pointers with examples?
A function has a physical location in the memory which is the entry point of the
function. And this is the address used when a function is called. This address can
be assigned to a pointer. Once a..more
C - Function Pointers
When you want to call a function DoIt() at a certain point called label in your program,
you just put the call of the function DoIt() at the point label in your source code.
Then you compile your ..more
Dos paint
This program is developed in Turbo C language. It is a simple paint program which is
developed by using my GUI library. We can able to draw a pictures as same as mspaint
I was developed some GUI tool kits in the GU
C interview questions and answers
This download contains Interview questions and answers for C programming. Very useful for freshers.
Parse XML ObjectiveC
1. Open Xcode and choose the “File” menu, in which you’ll click the “New Project…” item.
2. Click “Application” under “iPhone OS” in the list at left.
3. On the right, choose “Navigation-Based Application”. Th
ActionCube
ActionCube is a total conversion of Wouter van Oortmerssen´s FPS Cube. Set in a realistic looking environment, gameplay is fast and arcade-like. This game is all about team oriented multiplayer fun.
Console Calculator
Mini Calc:
This was simple standard calculator developed in Turbo C++ 3.0 using our
'GUI library'. The GUI library source code is also available in 'GUI library' page.
Running Your Program:
- Open a project f
Dos Screen saver
Dos screen saver:
How to make Screen Saver in Dos Mode
tick-tack-toe
tick-tack-toe
This was simple tick-tack-toe game developed in Turbo C++ 3.0
Running Your Program:
- Open a project file '.prj' from the source directory
- Setting up the include and lib path.
- Run the progr
Compiler Design in C
Compiler Design in C is now, unfortunately, out of print. You can often find used copies on the web. (Try Alibris, Bibliofind, BookFinder, and Half.com.) You can also read Andrew Schuleman's review of the book.
Get th
Is a prime number or not
# include
# include
using namespace std;
void main()
{
int value, x, i, j;
//input
coutvalue;
//calculation
for ( i=3 ; i..more
Alloc mem using Macro
#define Alloc_Mem(type,name,size) \
type *local_##name=NULL; \
type *name = local_##name ? local_##name : \
( local_##name = (type *)calloc(size, sizeof(type)) )
ICP_ARRAY(char, buf, ICP_MAX_BUF_SIZE);..more
C TCP socket example Server and Client program
// server.c
/* A simple server in the internet domain using TCP
The port number is passed as an argument */
#include
#include
#include
#include
#include
#include ..more
C UDP socket example Server and Client program
// Server
/* Creates a datagram server. The port
number is passed as an argument. This
server runs forever */
#include
#include
#include
#include
#include
#includ..more
Create Child Process - fork(): Sample program
// Create Child Process - fork():
#include
#include
// Required by for routine
#include
#include
using namespace std;
int globalVariable = 2;
main()
{
string sIdentifier;
int ..more
C program using System V shared memory segments in linux
// An example C program using System V shared memory segments follows.
It computes Pi, using the same algorithm given in section 1.3.
#include
#include
#include
#include
#include
#i..more
C String permutation sample program ABCD
// String permutation sample program ABCD
#include
#include
#include
#include
#include
#include
using namespace std;
void swap(char* src, char* dst)
{
char ch = ..more
C - Binary Search Tree example
Binary search tree:
#include <conio.h>
#include <process.h>
#include <iostream>
#include <malloc.h>
using namespace std;
struct node
{&n..more
C Program to Convert Integer to String
#include
#include
int main ()
{
int i;
char str[33];
printf ("Enter a number: ");
scanf ("%d",&i);
itoa (i,str,10);
printf ("decimal: %s\n", str);
itoa (i, str, 16);
printf ("hexadecimal: %s..more
C - Access a Class Member Function Without Creating a Class
In some cases, it is possible to call a class member
function without creating the class object.
In the following example, the program will
print "hello world" although class A has never been
created. When the program enters the "PrintMe"
f..more
Creating Pipes in C
Creating ``pipelines'' with the C programming
language can be a bit more involved than our
simple shell example. To create a simple pipe with
C, we make use of the pipe() system call. It takes
a s..
Example two processes comunicating via shared
shm_server.c, shm_client.c
We develop two programs here that illustrate the
passing of a simple piece of memery (a string)
between the processes if running simulatenously: ..
c/c++ Sockets UDP Tutorial
The client server model
Most interprocess communication uses the client
server model. These terms refer to the two
processes which will be communicating with each
other. One of the two processes, ..
C language - How to create child process? - f
The fork() system call will spawn a new child
process which is an identical process to the
parent except that has a new system process ID.
The process is copied in memory from the parent
and a new..
create a child process that creates a child p
Hi all I have been asked to: Write a C program
that will create a child process which is a simple
copy of the parent process and each should report
their existence by outputting its own PID and its..
SMP Linux - linux shared memory
Shared something is really "only share what needs
to be shared." This approach can work for general
MIMD (not just SPMD) provided that care is taken
for the shared objects to be allocated at the sa..
C - Shared Memory In Linux - Basic SHM setup
Linux, like most POSIX / System V compatible
operating systems prefer processes over threads,
as a matter of fact, a POSIX thread is nothing but
a process with a layer of abstraction. The main
mot..
Problem with shared memory in C under Linux
Hi guys,
I'm writing a program using shared memory segments
and I have the following problem:
first of all, I create a key, get a memory segment
and then attach it (I will post only the necessary
..
Polymorphism is the idea that a base class can be
inherited by several classes. A base class pointer
can point to its child class and a base class
array can store different child class objects...
Since this is often the opening question in an
interview, be extracareful that you don't run off
at the mouth. Keep your answer to a minute or two
at most. Cover four topics: early years,
education, work history, and recent ca..
An abstract class can have instance methods that
implement a default behavior. An Interface can
only declare constants and instance methods, but
cannot implement default behavior and all methods
are implicitly abstract. An int..