|
I would like to request an article that explains how to send a file (binary) over a winsock tcp connection. (MFC)
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
Kuniva,
Please see the attached sample code of a Winsock client. With a little bit of improvisation and MFC socket programming knowledge you could easily change it to your needs.
/***************************************/
/* This is the sample code for a client that send and receives some data from a server.*/
DownloadFileFromInternet(CString strAddress)
{
char buff[1024];
int s;
struct sockaddr_in a;
struct hostent *h;
WSADATA wsaData;
int SERVER_PORT = 1223;// The server port to which the client will connect.
// This call initializes the Winsock.dll
WSAStartup(0x101, &wsaData);
// Initializing the sockaddr_in datastructer with all zeroes.
memset(&a,0,sizeof(a));
// First assume an Internet dotted form address e.g. 198.168.0.1
a.sin_family = AF_INET;
a.sin_port = htons(SERVER_PORT); // Connect to the server port
a.sin_addr.s_addr = inet_addr("127.0.0.1"); // Connect to the localhost. Replace this address with the IP address of the server.
/////////////////////////////////////////////
// You may use descriptive Internet (e.g. www.microsoft.com) instead of the dotted (e.g. 127.0.0.1) one.
h = gethostbyname("www.microsoft.com"); // change this address to the desired server's address.
if (h != NULL)
{
a.sin_addr.s_addr = ((LPIN_ADDR)h->h_addr)->s_addr;
}
else
{
AfxMessageBox("Cannot resolve hostname\n");
WSACleanup();
return FALSE;
}
// create the socket.
s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
if (s == 0)
{
AfxMessageBox("Cannot establish connection: ");
WSACleanup(); // Winsock.dll cleanup code
return FALSE;
}
// socket succesfully created, now we may connect to the server
if (connect(s, (struct sockaddr *)&a, sizeof(a)))
{
//Can not establish the connection to the server
WSACleanup();
return FALSE;
}
// Connection established with the server. Start receiving data from the server
int k=0;
k = recv(s, buff, 1024, 0);
if (k<0)
{
// An error occurred while trying to receive data
closesocket(s); // close the opened socket.
WSACleanup(); // clean up Winsock.dll
return FALSE;
}
buff[k] = '\0';
// we will NULL terminate the received data from the server.
// We will send "WA-ALIKUMASALAM" to the server.
k=0;
while (k < int(strlen("WA-ALIKUMASALAM")))
{ // keep sending until all the data is sent.
k = send(s,"WA-ALIKUMASALAM",strlen("WA-ALIKUMASALAM"),0);
}
// We are finished. Now its time to close the socket
closesocket(s);
return TRUE;
}
/*****************************************/
Software Engineer (Techlogix (pvt)ltd)
Visiting Faculty Informatics, Lahore
|
|
|
|
|
Thought I would try something different in the requests here.
Basically we need to show to a client that a web interface can be pretty damned "spiffy" and very interactive. They think that ALL web interfaces are like Amazon or Yahoo.
Now I could write my own interface with real-time alerts, videos, animations and all the bells and whistles (including a moving graph), but that would be a big waste of money if they turned around and said "no, we are dropping the project."
I know the first response to this will be a Flash interface, but we want to also find a good non-flash, DHTML-using interface.
So does anyone have any links to games like this? Preferably related to stock markets, buying shares etc.
thanks in advance
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
Martin Marvinski wrote:
Unfortunatly Deep Throat isn't my cup of tea
Do you Sonork? I do! 100.9903 Stormfront
|
|
|
|
|
Probably not exactly what you want but pretty impressive IMO DHTML page is http://www.htmlguru.com/. I don't like the usability of the interface and graphics not the best, but it looks pretty cool for pure DHTML.
|
|
|
|
|
It seems like the writers at MicroSoft just love VB, and any example that does anything that comes near to getting my interest is done in VB, when I would love to see it in VC or C#. So, does anyone have a C# or VC++ example of the following :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnadvnet/html/vbnet10142001.asp
|
|
|
|
|
I want to make a DLL with a dialog that I can call from my app. Can anyone give me a basic example of how to do this? I would like a a DLL source that just launches a dialog on a call from a basic program. Or can someone give me tips on how to do this? I have found the articles here do not focus on the basics of DLLs. Thanks if you can help.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
I am not sure if this is what you wanted, but to create a dll in VC5 all you have to do is this:
Create a new win32 dll project (empty).
Create a .h and .c file like this:
/////////////////////////////////////////////////////////////////////
// File quicktest.h
/////////////////////////////////////////////////////////////////////
#ifndef _WINDOWS_
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
/////////////////////////////////////////////////////////////////////
#ifdef _cplusplus
extern "C"
{
#endif
/////////////////////////////////////////////////////////////////////
void WINAPI SomeFunc(PSTR someText);
/////////////////////////////////////////////////////////////////////
#ifdef _cplusplus
}
#endif
/////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////
// File quicktest.c
/////////////////////////////////////////////////////////////////////
void WINAPI SomeFunc(PSTR someText)
{
MessageBox(GetDesktopWindow(), someText, TEXT("Some title"), MB_OK);
}// someText()
/////////////////////////////////////////////////////////////////////
And while those files are cooking, you take a new file and call it something like: quicktest.def, and put in something like this:
LIBRARY quicktest
DESCRIPTION 'Some functions for blah blah'
EXPORTS
SomeFunc @1
Then you press compile, and voila!, a dll...
Jan
"It could have been worse, it could have been ME!"
|
|
|
|
|
Many moons ago I took a course in MFC, during the course of which we where shown some very simple MFC code which allowed a user to draw shapes on a view and save them to a file. I need something a little more sophisticated (although I amn't talking about developing a 'paint' application), my intention is to provide a simple canvas for the user to draw on, and write the results to a bitmap file. Anyone know any simple examples of this type of thing ?
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
Try using Visual Basic. It takes about 10 lines of code to make an app like you are suggesting...
Hey you asked for the reply! Let this be a lesson.... The Lounge is for irrelevant, aimless, meandering, long winded, pompous opinion soap boxing. Not advertising or intelligent questions...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
Its ultimately for Window CE, using Embedded Visual Basic is NOT an option.
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
Ray Kinsella wrote:
Its ultimately for Window CE, using Embedded Visual Basic is NOT an option.
Read the front page of CodeProject! The latest news is of Windows CE .NET which supports amongst other things VB.NET.
VB triumphs again! Wooooooohoooooo...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
You know what's really scaring me Paul? The day is fast approaching when I will need to add a VB .NET tab to the main page.
mercy.
cheers,
Chris Maunder
|
|
|
|
|
Chris Maunder wrote:
when I will need to add a VB .NET tab to the main page
How so? It is weird but I must have spent at most 1hour playing with VB.NET the whole time I have had .NET. The rest of the time I have been going oooo and aaaaah over C# or ASP.NET (using C# as the language.)
I am not seeking a higher position in peoples eyes by using C# rather than VB.NET. It is just that C# has really grabbed my interest. It works a lot more like I think than even VB used to.
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
Paul Watson wrote:
Let this be a lesson.... The Lounge is for irrelevant, aimless, meandering, long winded, pompous opinion soap boxing
Just too bad this is not the Lounge
---
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
PJ Arends wrote:
Just too bad this is not the Lounge
hehe, it is now...
regards,
Paul Watson
Bluegrass
Cape Town, South Africa
Do you Sonork? I do! 100.9903 Stormfront
"The greatest thing you will ever learn is to love, and be loved in return" - Moulin Rouge
|
|
|
|
|
|
Ravi,
You are the King, this is exactily what I am after!!!!!!!!!!!
Thanks
Regards
Ray
"Je Suis Mort De Rire"
|
|
|
|
|
There is an electronic item called TiVo:
- It is the most popular Digital Video Recorder (DVRs). It is like VCRs, but with a hard disk and without the hassles of videotapes.
- TiVo automatically finds and digitally records your family's favorite shows so you'll never "forget" to schedule a recording again.
- With TiVo you can watch your favorite shows on your own time. At last, TV fits into your busy life, not the other way around.
I want to write a program that do the same things like TiVo but I will use my computer to do it. If you find this idea sound fantastic, please show me where to start.
Thanks in advance,
Best Regards,
Vo Hong Hai
Vo Hong Hai
Hanoi, Vietnam
|
|
|
|
|
There are a number of similiar projects already under way, you should be able to find details of them on sourceforge.net. Most are Linux Open source projects but a Windows version is also likely.
You'll need to decide on the Video Capture hardware and see what software support it gives you. In theory you use the hardware to capture an MPEG file and save it to the hard-disk. The difficulty begins when you want to add the intelligent recording as you'll need access to the TV listings in a digital form.
Michael
|
|
|
|
|
HAPPY NEW YEAR!!!!!!
pls help!!!!! i'm a beginner in programming and i'm in desperate need of a code for tracing all the edges of a graph without retracing any edge twice. i'm getting nuts over this problem.
i already know how to determine whether it's a eulerian or not but my biggest problem is implementing fleury's algorihm. so guys, please help me!!!!!!!
chococake
|
|
|
|
|
help!!!!!!! i need a code on how to count the minimum possible strokes needed to visit all the edges of a graph without traversing the edges twice....... do u guys know any?? pls help!!
i badly need the implementation of fleury's algorithm on finding a eulerian path or walk. please guys, help me!!!
|
|
|
|
|
I am trying to develop a Borland C++ program that will allow the user to enter details for an invoice and produce it to the VDU.
1. The program must be menu driven (which I have done)
2. Generate a new invoice number for each invoice raised (done)
3. Require the user to enter all of the customer details, require the user to enter a product code only (the program should output, a product description and price, or an error message if code not recognised)
4. Require the user to enter the quantity, the program should then calculate and display the total for that item.
5. On completion of input to invoice value should be calculated and displayed into to invoice
6.The program should update the stock file, and display a message if the components in stock are less that the components required for the order.
7.On termination of the program create a report in form of a text file detailing components which are below minimum stock level and the quantity of each component that needs to be ordered.
8.In order to calculate the overall value of order please note – all prices are exclusive of VAT @17.5%
There is a discount of 2.5% of orders = £2500 <£5000, a discount of 3.25% for orders of £5000+, less than £2500 receive no discount - These only apply to Account Code D customers
A, B or C customers receive a discount anyway Account Code A = 10.0% discount, Account Code B = 6.250%, Account Code C = 5.00%They do not get the other discount.
9. You are only allowed to enter 6 product per invoice
I have done parts 1 & 2 with no problem and an kind of there for the rest. I would appreciate some help me with my coding for the program. I have only been doing C++ for 6 weeks and am expected to be able to do all this along with the JSPs & Black Box testing.
The main problem I’m having is converting a binary file to text file and for the program to read from the binary file.
Below is the code
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<iomanip.h>
#include<stdlib.h>
#include<ctype.h>
#include<dos.h>
#include<string.h>
//file pathe defined
char Response;
char Answer;
struct CustomerRecord
{//start of struct CustomerDetails
char AccountNo[7];
char LastName[15];
char FirstName[15];
int HouseNo;
char AddFirstLine[50];
char AddSecondLine[50];
char AddThirdLine[50];
char PostCode[10];
char AccountType;
};//end of structure CustomerDetails
struct StockDetails
{//start of struct StockDetails
char Code[7];
char Desc[50];
float Price;
int QStock;
int RLevel;
int RQuant;
};//end of structure StockDetails
struct date d;//set structure for date
//declaration of functions
void readStockDetails(StockDetails&);
void readCustomerRecord(CustomerRecord&);
void ContinuationMenu();
void displayStockPurchase();
void displayScreenInvoice();
void displayCustomerDetails();
void displayAddNewStockRecord();
void displayAddNewCustomerRecord();
void displayMainMenu();
void OpenStockFile();
void OpenCustomerFile();
void getAnswer(char&);
char anotherRecord();
char anotherRecord(char,char);
char anotherCustomerRecord();
char anotherCustomerRecord(char,char);
void displayExitingProgram();
void readStockFile();
void readCustomerFile();
const char FILESTOCK[]="c:\\stockfile.dat";//system file name
const char FILECUSTOMER[]="c:\\customerfile.dat";//system file name
//const float A=10;
//const float B=6.25;
//const float C=5;
void main()
{//start of function main
ContinuationMenu();
}//end of function main
void ContinuationMenu()
{//start of function continuation menu
gotoxy(33,2);//locate cursor
cout<<"***************";//display output
gotoxy(33,3);//locate cursor
cout<<"* *";//display output
gotoxy(33,4);//locate cursor
cout<<"* MICROSERV *";//display output
gotoxy(33,5);//locate cursor
cout<<"* *";//display output
gotoxy(33,6);//locate cursor
cout<<"***************";//display output
gotoxy(32,8);//locate cursor
cout<<"CONTINUATION MENU";//display output
gotoxy(32,9);//locate cursor
cout<<"=================";//display output
gotoxy(32,11);//locate cursor
cout<<"C - CONTINUE";//display output
gotoxy(32,13);//locate cursor
cout<<"X - EXIT SYSTEM";//display output
gotoxy(32,15);//locate cursor
cout<<"Your choice please :";//display output
do
{
gotoxy(52,15);//locate cursor
getAnswer(Response);
gotoxy(52,15);//reposition cursor for re-entery
cout<<" ";//clears user input
switch (Response)
{
case 'C': case 'c':
displayMainMenu();
break;
case 'X': case 'x':
displayExitingProgram();
break;
default:
gotoxy(28,18);
cout<<"Please enter a valid choice. \n\a";
}
}while(!(Response=='X'));
}//end of function continuation menu
void getAnswer(char &Let)
{
Let=getche();
if(Let>'Y')
Let-=32;
//end of if
}//end of function get answer
//display main menu
void displayMainMenu()
{//start of function display main menu
clrscr();
gotoxy(33,2);
cout<<"***************";//display output
gotoxy(33,3);
cout<<"* *";//display output
gotoxy(33,4);
cout<<"* MICROSERV *";//display output
gotoxy(33,5);
cout<<"* *";//display output
gotoxy(33,6);
cout<<"***************";//display output
gotoxy(36,8);
cout<<"MAIN MENU";//display output
gotoxy(36,9);
cout<<"==========";//display output
gotoxy(28,11);
cout<<"P - DISPLAY STOCK PURCHASES";//display output
gotoxy(28,13);
cout<<"C - DISPLAY CUSTOMER DETAILS";//display output
gotoxy(28,15);
cout<<"I - DISPLAY INVOICE DETAILS";
gotoxy(28,17);
cout<<"X - EXIT SYSTEM";//display output
gotoxy(28,19);
cout<<"Your choice please :";//display output
do
{
gotoxy(48,19);
getAnswer(Response);
gotoxy(48,19);//repositions cursor
cout<<" ";//clears user input
switch(Response)
{
case 'P': case'p':
displayStockPurchase();
break;
case 'C': case'c':
displayCustomerDetails();
break;
case 'I': case'i':
displayScreenInvoice();
break;
case 'X': case'x':
displayExitingProgram();
break;
default:
gotoxy(28,21);
cout<<"Please enter a valid choice. ";
break;
}//end of switch statment
}while(!(Response=='X'));
}//end of display menu main
//display stock purchase menu
void displayStockPurchase()
{//start of function display stockpurchase
char Response;
clrscr();
gotoxy(33,2);
cout<<"***************";//display output
gotoxy(33,3);
cout<<"* *";//display output
gotoxy(33,4);
cout<<"* MICROSERV *";//display output
gotoxy(33,5);
cout<<"* *";//display output
gotoxy(33,6);
cout<<"***************";//display output
gotoxy(36,8);
cout<<"STOCK MENU";//display output
gotoxy(36,9);
cout<<"==========";//display output
gotoxy(28,11);
cout<<"A - ADD NEW ITEM";//display output
gotoxy(28,13);
cout<<"V - VIEW ITEM";//display output
gotoxy(28,15);
cout<<"B - BACK TO MAIN MENU";//display output
gotoxy(28,17);
cout<<"Your choice please :";//display output
do
{
gotoxy(48,17);
getAnswer(Response);
gotoxy(48,17);
cout<<" ";
switch(Response)
{
case 'A': case 'a':
displayAddNewStockRecord();
break;
case 'V': case 'v':
OpenStockFile();
break;
case 'B': case 'b':
displayMainMenu();
break;
default:
gotoxy(28,19);
cout<<"Plaese enter a vali choice :";
break;
}//end of switch statment
}while(!(Response=='X'));
}//end of function display stock purchase menu
void displayAddNewStockRecord()
{//start of function main
StockDetails Stock;//record variable name
char Response='Y';
//open a binary file for output appending to existing file
ofstream StockFile(FILESTOCK,ios::binary|ios::app);
//display message if file opening error
if(StockFile.fail())
{cout<<"Error opening file "<<filestock;
exit(1);
="" }
="" enter="" customer="" data
="" while(response="" !="N" )
="" {
="" readstockdetails(stock);
="" stockfile.write((char*)&stock,sizeof(stock));
="" response="anotherRecord('N'," 'y');
="" stockfile.close();="" close="" output="" file
="" cout<<"\n\ninput="" terminated="" ";
="" getch();
="" displaystockpurchase();
}="" end="" of="" function="" main
="" definition="" readcustomerdetails
void="" readstockdetails(stockdetails="" &stock)
{="" start="" readcustomerdetails
="" clrscr();
="" gotoxy(33,2);
="" cout<<"***************";="" display="" output
="" gotoxy(33,3);
="" cout<<"*="" *";="" gotoxy(33,4);
="" microserv="" gotoxy(33,5);
="" gotoxy(33,6);
="" gotoxy(23,9);
="" cout<<"code="" no:="" cin="">>Stock.Code;
cin.ignore();
gotoxy(23,11);
cout<<"Description: ";
cin.getline(Stock.Desc, 50);
gotoxy(23,13);
cout<<"Price: £";
cin>>Stock.Price;
cin.ignore();
gotoxy(23,15);
cout<<"Qty in stock: ";
cin>>Stock.QStock;
cin.ignore();
gotoxy(23,17);
cout<<"Qty reorder level: ";
cin>>Stock.RLevel;
cin.ignore();
gotoxy(23,19);
cout<<"Reorder Qty: ";
cin>>Stock.RQuant;
cin.ignore();
}//end of function readCustomerDetails
char anotherRecord(char Ch1, char Ch2)
{//start of function anotherRecord
char Ch;
gotoxy(wherex(), wherey());
cout<<"Another record y/n?: ";
do
{
gotoxy(wherex(),wherey());
Ch=getche();
if(Ch > Ch2)
Ch -=32;
if(Ch <ch1 ||="" ch=""> Ch2)
cout<<"\b\a";
}while(Ch < Ch1 || Ch > Ch2);
return Ch;
}//end of function anotherRecord
void OpenStockFile()
{
clrscr();
cout<<"File contents:\n\n";
readStockFile();
}
//function displayScreenInvoice
void displayScreenInvoice()
{//start of function displayScreenInvoice
getdate(&d);//get system date
clrscr();
gotoxy(3,1);//locate cursor
cout<<"Invoice No :";//display output
gotoxy(3,4);//locate cursor
cout<<"Name :";//display output
gotoxy(3,5);//locate cursor
cout<<"Address:";//display output
gotoxy(3,9);//locate cursor
cout<<"Account No.:";//display output
gotoxy(24,9);//locate cursor
cout<<"A/C Type:";//display output
gotoxy(35,9);//locate cursor
cout<<"Invoice Date:";//display output
gotoxy(4,10);//locate cursor
cout<<"Code";//display output
gotoxy(14,10);//locate cursor
cout<<"Description";//display output
gotoxy(36,10);//locate cursor
cout<<"Price £ Qty";//display output
gotoxy(50,10);//locate cursor
cout<<"Total £";//display output
gotoxy(50,17);//locate cursor
cout<<"-------";//display output
gotoxy(43,18);//locate cursor
cout<<"Total";//display output
gotoxy(40,19);//locate cursor
cout<<"Discount";//display output
gotoxy(50,20);//locate cursor
cout<<"-------";//display output
gotoxy(38,22);//locate cursor
cout<<"VAT @ 17.5%";//display output
gotoxy(50,23);//locate cursor
cout<<"-------";//display output
gotoxy(50,25);//locate cursor
cout<<"=======";//display output
//generate random 6 digit invoice number
gotoxy(16,1);//locate cursor
int Number[6];
randomize();
for(int j=0; j<6; j++)
{
Number [j]=(rand()%10);
cout<<number[j];
}
generate="" invoice="" date
gotoxy(49,9);="" locate="" cursor
printf("%d",d.da_day);
printf("="" ");
printf("%d",d.da_mon);
printf("="" ");
printf("%d",d.da_year);
response="anotherRecord();
" if(response="='N')
" {
="" gotoxy(2,24);="" cursor
="" cout<<"press="" any="" key="" to="" return="" main="" menu";
="" getch();
="" clrscr();
="" displaymainmenu();
="" }
}="" end="" function
="" function="" readproductcode
char="" anotherrecord()
{="" start="" of="" function
="" char="" response;
="" gotoxy(wherex(),="" wherey());
="" gotoxy(2,24);
="" cout<<"another="" record="" y="" n?:="" ";
do
="" getanswer(response);
="" !="Y" ||="" response="" )
="" cout<<"\b";
="" }while(!(response="='Y'" cout<<"="" ";
="" response;
};
void="" readstockfile()
{="" readstockfile
="" stockdetails="" stock;
="" open="" a="" binary="" file="" for="" output
="" ifstream="" stockfile(filestock,ios::binary);
="" display="" message="" if="" opening="" error
="" if(stockfile.fail())
="" cout<<"error="" "<<filestock;
="" exit(1);
="" }
="" read="" first="" record
="" stockfile.read((char*)&stock,sizeof(stock));
="" while(!stockfile.eof())
="" {="" while="" !eof
="" cout<<"code="" no.:="" "<<stock.code<<endl;
="" cout<<"description:="" "<<stock.desc<<endl;
=""
="" cout<<"price:="" "<<stock.price<<endl;
="" cout<<"qty="" in="" stock:="" "<<stock.qstock<<endl;
="" reorder="" level:="" "<<stock.rlevel<<endl;
="" cout<<"reorder="" qty:="" "<<stock.rquant<<endl;
="" cout<<"\n\n";
="" readnext="" stockfile.read((char*)&stock,sizeof(stock));
="" }="" !eof
="" stockfile.close();="" close="" input="" file
="" cout<<"end="" stock="" file,="" press="" displaystockpurchase();
}
void="" displaycustomerdetails()
{
char="" response;
clrscr();
gotoxy(33,2);
cout<<"***************";="" output
gotoxy(33,3);
cout<<"*="" *";="" output
gotoxy(33,4);
cout<<"*="" microserv="" output
gotoxy(33,5);
cout<<"*="" output
gotoxy(33,6);
cout<<"***************";="" output
gotoxy(34,8);
cout<<"customer="" menu";="" output
gotoxy(34,9);
cout<<"="============";//display" output
gotoxy(28,11);
cout<<"a="" -="" add="" new="" customer";="" output
gotoxy(28,13);
cout<<"v="" view="" customer="" details";="" output
gotoxy(28,15);
cout<<"b="" back="" output
gotoxy(28,17);
cout<<"your="" choice="" please="" :";="" output
do
{
gotoxy(48,17);
getanswer(response);
gotoxy(48,17);
cout<<"="" ";
="" switch(response)
="" case="" 'a':="" displayaddnewcustomerrecord();
="" break;
="" 'v':="" 'v':
="" opencustomerfile();
="" 'b':="" 'b':
="" displaymainmenu();
="" default:
="" gotoxy(28,19);
="" cout<<"plaese="" enter="" valid="" :";
="" switch="" statment
}while(!(response="='X'));
}
void" opencustomerfile()
{
clrscr();
cout<<"\n\n";
readcustomerfile();
}
void="" displayaddnewcustomerrecord()
{="" displayaddnewcustomerrecord
customerrecord="" customer;
char="" ;
ofstream="" customerfile(filecustomer,ios::binary|ios::app);
if(customerfile.fail())
{
cout<<"error="" "<<filecustomer;
exit(1);
}
while(response!="N" )
{
readcustomerrecord(customer);
customerfile.write((char*)&customer,="" sizeof(customer));
response="anotherRecord('N'," 'y');
}
customerfile.close();
cout<<"\n\ninput="" terminated="" ";
getch();
displaycustomerdetails();
}="" displayaddnewcustomerrecord
void="" readcustomerrecord(customerrecord="" &customer)
{
clrscr();
="" gotoxy(33,2);
="" cout<<"***************";="" gotoxy(33,3);
="" cout<<"*="" gotoxy(33,4);
="" gotoxy(33,5);
="" gotoxy(33,6);
="" gotoxy(23,9);
="" cout<<"account="" no:="" cin="">>Customer.AccountNo;
cin.ignore();
gotoxy(23,11);
cout<<"Last Name: ";
cin.getline(Customer.LastName, 15);
gotoxy(23,13);
cout<<"First Name: ";
cin.getline(Customer.FirstName, 15);
gotoxy(23,15);
cout<<"House No: ";
cin>>Customer.HouseNo;
cin.ignore();
gotoxy(23,17);
cout<<"Address Line 1: ";
cin.getline(Customer.AddFirstLine, 50);
gotoxy(23,19);
cout<<"Address Line 2: ";
cin.getline(Customer.AddSecondLine, 50);
gotoxy(23,21);
cout<<"Address Line 3: ";
cin.getline(Customer.AddThirdLine, 50);
gotoxy(23,23);
cout<<"Post Code: ";
cin.getline(Customer.PostCode, 10);
gotoxy(23,25);
cout<<"Account Type: ";
cin>>Customer.AccountType;
}
void readCustomerFile()
{
CustomerRecord Customer;
ifstream CustomerFile(FILECUSTOMER,ios::binary);
if(CustomerFile.fail())
{
cout<<"Error Opening File "<<filecustomer;
exit(1);
}
customerfile.read((char*)&customer,sizeof(customer));
while(!customerfile.eof())
{
cout<<"account no:="" "<<customer.accountno<<endl;
cout<<"first="" name:="" "<<customer.firstname<<endl;
cout<<"last="" "<<customer.lastname<<endl;
cout<<"house="" "<<customer.houseno<<endl;
cout<<"address:="" "<<customer.addfirstline<<endl;
cout<<"="" "<<customer.addsecondline<<endl;
cout<<"="" "<<customer.addthirdline<<endl;
cout<<"post="" code:="" "<<customer.postcode<<endl;
cout<<"account="" type:="" "<<customer.accounttype<<endl;
cout<<"\n\n";
customerfile.read((char*)&customer,sizeof(customer));
}="" end="" of="" while="" !="" eof
customerfile.close();
cout<<"end="" customer="" file,="" press="" any="" key="" to="" return="" menu.";
getch();
displaycustomerdetails();
}
void="" displayexitingprogram()
{
clrscr();
gotoxy(27,9);
cout<<"thankyou="" for="" your="" custom";
gotoxy(30,12);
cout<<"exiting="" system.....";
}
char="" anothercustomerrecord(char="" ch1,="" char="" ch2)
{="" start="" function="" anotherrecord
char="" ch;
gotoxy(wherex(),wherey());
cout<<"another="" record="" y="" n?:="" ";
do
{
gotoxy(wherex(),wherey());
ch="getche();
if(Ch">Ch2)
Ch-=32;
if(Ch<ch1||ch>Ch2)
cout<<"\b\a";
}while(Ch<ch1||ch>Ch2);
return Ch;
}//end of function anotherRecord
|
|
|
|
|
Hi~
I want to write a VB code to send and receive the SMS from my mobile phone via cable. Does anyone do this kind of project in here? Could you give the code of your project?
Thank you very much~~
|
|
|
|
|
Does anybody know how I can read links and click links from a web page from within my c++ program. I am hoping to be able to do this for any webpage, so I will not know in advance what links will be there.
Help is most appreciated.
Regards,
SAK
HAPPY HOLIDAYS
|
|
|
|
|
SAK wrote:
Does anybody know how I can read links and click links from a web page from within my c++ program. I am hoping to be able to do this for any webpage, so I will not know in advance what links will be there.
This is a little delayed you may have figurd it out i dunno...it's late, i'm bored and love CP so i'll offer my suggestions even still*s*
Do some research on IWebBrowser2
Laterz
"An expert is someone who has made all the mistakes in thier field" - Niels Bohr
|
|
|
|
|