易截截图软件、单文件、免安装、纯绿色、仅160KB

c++ mysql

/*
 * test.cpp
 *
 *  Created on: 2010-5-13
 *      Author: Sarah
 */
  #include   "/usr/include/mysql/mysql.h"   /*为绝对路径*/
  #include   <stdio.h>
#include <stdlib.h>
#include <string>
#include <iostream>
using namespace std;
  int   main(int   argc,char   *argv[])
  {
  char   *user   =   "root",   *pwd   =   "475475",   *dbname   =   "bookman";
  MYSQL   mysql;
  MYSQL_RES   *mysql_ret;
  MYSQL_ROW   mysql_row;
  unsigned   long   num_rows;
  int   ret;
  mysql_init(&mysql);
  if(mysql_real_connect(&mysql,NULL,user,pwd,dbname,0,NULL,0))
  {
  printf("Connection   success!\n");
  //sql字符串
  string sqlstr;
  sqlstr ="INSERT INTO booklist VALUES (3,'friend','Jack',2,1);";
  if(0==mysql_query(&mysql,sqlstr.c_str()))
  {
   cout<<"mysql_query() insert data succeed"<<endl;
  }
  else
  {
   cout<<"mysql_query() insert data failed"<<endl;
   return -1;
  }
  ret   =   mysql_query(&mysql,"select   *   from   booklist");
  if(!ret)
  {
  printf("Query   Success!\n");
  mysql_ret   =   mysql_store_result(&mysql);
  if(mysql_ret   !=   NULL)
  {
  printf("Store   Result   Success!\n");
  num_rows   =   mysql_num_rows(mysql_ret);
  if(num_rows &n


相关文档:

C/C++学习笔记[01].纵向打印整数

#include <stdio.h>
#include <string.h>
#include <math.h>
#define BASE 10
int intlen(long n);
int main()
{
int i, j, num, sz;
i = j = num = sz = 0;
if (!scanf("%d", &num) || num <= 0) {
printf("invalid input\n");
retu ......

教你理解复杂的C/C++声明[转]

原文:
http://www.codeproject.com/cpp/complex_declarations.asp
作者:Vikram A Punathambekar
介绍
曾经碰到过让你迷惑不解、类似于int * (* (*fp1) (int) ) [10];这样的变量声明吗?本文将由易到难,一步一步教会你如何理解这种复杂的C/C++声明:我们将从每天都能碰到的较简单的声明入手,然后逐步加入const修 ......

linux 下C、C++编程资料




GCC    中文手册   
     http://www.nbfan.com/forum/dispbbs....&ID=1433&page=1   
     GNU    make    指南   
     http:/ ......

50个C/C++源代码网站


50个c/c++源代码网站
文章出处:http://blog.chinaunix.net/u3/106835/showart_2190632.html
C/C++是最主要的编程语言。这里列出了50名优秀网站和网页清单,这些网站提供c/c++源代码
。这份清单提供了源代码的链接以及它们的小说明。我已尽力包括最佳的C/C++源代码的网站。这不是一个完整的清单,您有建议可以联系我, ......

C/C++与Java函数重载区别!

#include <iostream>
using namespace std;
class Base {
public:
virtual void fn(int x) {
cout << "In Base class, int x = " << x << endl;
}
};
class SubClass : public Base {
public:
// 函数的重载,这样的重载方式,在Java中能行,在C/C++中却不行
virt ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号