易截截图软件、单文件、免安装、纯绿色、仅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++运行中的一些问题及其解决

本人在做毕设的时候遇到的一些问题,在这里总结一下,希望会对大家有些帮助~有不足之处还望指出,大家共同进步^_^
 一、基本介绍:
1.运行环境VC6.0(Microsoft Visual C++ 6.0)(http://40.duote.org/microsoft_visualc6.zip)
2.课题相关内容:AVS视频编码
二、出现的问题及解决方法:
1.问题:
fatal er ......

查找字符串中字符不重复的最大子串(C/C++)

 //输入参数:*str 搜索字符串
// subStrLen 用于返回找到的最大子字符串长度
//返回:找到的最大子字符串指针
char * findMaxSubStr(char *str, int &subStrLen){
char *subStr;
char *p = str;
int index[256] ;
for (int ix = 0; ix < sizeof(index)/sizeof(index[0]); ix++)
{
in ......

organizing code files in C & C++

http://www.gamedev.net/reference/programming/features/orgfiles/page2.asp
通过四个pitfall讲解头文件的由来和好处,以及使用头文件定义inline func and template.
Remember that, as far as the compiler is concerned, there is absolutely no difference between a header file and a source file.
The key idea ......

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


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

转:Linux下进行MYSQL的C++编程起步手记


Linux下进行MYSQL的C++编程起步手记
首先安装必需的开发包
sudo apt-get install gcc g++ libgcc1 libg++ make gdb
安装MYSQL的C语言开发包
sudo apt-get install libmysql++-dev libmysql++2c2a libmysqlclient15-dev libmysqlclient15off
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号