ODBC C±à³Ì·ÃÎÊÊý¾Ý¿â
н¨Ò»¸öWin32 Application£¬²¢ÔÚÏàÓ¦Îļþ¼ÐÏÂн¨Ò»¸öbook.mdb£¬ ÀïÃæÓÐÒ»¸ö±íBookInfo£¬±íÖÐÓÐÒÔϼ¸Àý£º
id:
BookName:
Author:
µÈ£»
//------------------------------------------------------------------------------
// Copyright (c) 2009 eryar All rights reserved.
//
// File : Main.cpp
// Author : eryar@163.com
// Date : 2009-11-8 16:09
// Version : 1.0v
//
// Description : ODBC±àд³ÌÐò·ÃÎÊÊý¾Ý¿âµÄ²Ù×÷ʾÀý¡£
//
//==============================================================================
#include <windows.h>
#include <sqlext.h>
#include <odbcinst.h>
#define IDM_FILE_OPEN 100001
#define IDM_FILE_EXIT 100002
#define IDM_HELP_CONTENT 200001
#define IDM_HELP_ABOUT 200002
#define IDM_DATA_CONNECT 300001
#define IDM_DATA_QUERY 300002
char* szAppName = "ODBC Demo";
HINSTANCE ghInst;
HMENU WinMainMenu(HWND);
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
HWND hWnd;
MSG Msg;
WNDCLASS wndclass;
char* szClassName = "CODBC";
ghInst = hInstance;
wndclass.style = CS_HREDRAW|CS_VREDRAW;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.lpfnWndProc = WndProc;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon(NULL, IDI_APPLICATION);
wndclass.hCursor = LoadCursor(NULL, IDC_ARROW);
wndclass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szClassName;
if (!RegisterClass(&wndclass)) {
MessageBox(NULL, "This program requires Windows NT! ", szAppName, MB_OK|MB_ICONERROR);
return 0;
}
hWnd = CreateWindow(szClassName,
szAppName,
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL,
NULL,
hInstance,
NULL);
ShowWindow(hWnd, nShowCmd);
UpdateWindow(hWnd);
while (GetMessage(&Msg, NULL, 0, 0)) {
Tra
Ïà¹ØÎĵµ£º
£¨×ª×Ô£©http://blog.pfan.cn/whyhappy/6030.html
º¯ÊýÃûÓ뺯ÊýÖ¸Õë
Ò» ͨ³£µÄº¯Êýµ÷ÓÃ
Ò»¸öͨ³£µÄº¯Êýµ÷ÓõÄÀý×Ó£º
//×ÔÐаüº¬Í·Îļþ
void MyFun(int x); //´Ë´¦µÄÉêÃ÷Ò²¿Éд³É£ºvoid MyFun( int );
int main(int argc, char* argv[])
{
......
Keil CÀïÓõ½ÁËunsigned long³¤ÕûÐͱäÁ¿£¬±àÒëʱ¶¼ÄÜͨ¹ý£¬µ«ÔËÐÐʱÀÏÊÇÒç³ö£¬Í¬»ï°Ù¶Èµ½ÁË´ËÌù£¬½â¾öÁËÎÊÌ⣬ÓÚÊÇתÌûÓÚ´Ë£º
½ñÌìµ÷ÊÔÒ»¸ö³Ë·¨£¬³öÁ˵ãÎÊÌ⣬ÏÈ¿´´úÂëʾÒ⣺
void test(void)
{
unsigned long mid1,mid2,mid3;
mid1 ......
#include <stdio.h>
#include <unistd.h>
#define FOO "foo"
int main(void)
{
if(!access(FOO, F_OK))
{
if(!unlink(FOO))
{
}
else
{
printf("remove %s failed\n", FOO);
}
}
else
{
printf("%s not existed\ ......
1.ÇóÏÂÃæº¯ÊýµÄ·µ»ØÖµ£¨Î¢Èí£©
¡¡¡¡int func(x)
¡¡¡¡{
¡¡¡¡int countx = 0;
¡¡¡¡while(x)
¡¡¡¡{
¡¡¡¡countx ++;
¡¡¡¡x = x&(x-1);
¡¡¡¡}
¡¡¡¡return countx;
¡¡¡¡}
¡¡¡¡¼Ù¶¨x = 9999¡£ ´ð°¸£º8
¡¡¡¡Ë¼Â·£º½«xת»¯Îª2½øÖÆ£¬¿´º¬ÓеÄ1µÄ¸öÊý¡£
¡¡¡¡2. ʲôÊÇ“ÒýÓÔ£¿ÉêÃ÷ºÍʹÓÓÒýÓ ......