刘华世的官方博客
上一页 1 2 3 4 5 6 7 ··· 10 下一页
摘要: #include <stdio.h>main(){ printf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n "); printf(" 欢迎光临C语言世界\n"); printf("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n ");}////////////////////////////0#include <stdio.h>main(){ printf("表达式1的值:%f\n",99.7*0.26+4.25); printf("表达 阅读全文
posted @ 2013-01-04 17:52 pythonschool 阅读(904) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>/*C语言 结构体的应用*/typedef struct{ char bookname[40]; //书名 char author[20]; //作者 float price; //价格} BOOK;int main(int argc, char* argv[]){ BOOK b1, b2, b; scanf("%s %s %f", b1.bookname, b1.author, &b1.price); scanf("%s %s %f", b2.bookname, b2.author, &b 阅读全文
posted @ 2013-01-04 17:52 pythonschool 阅读(2025) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>#include <stdlib.h>/*C语言 将键盘输入的字符写入文件*/int main(int argc, char* argv[]){ FILE *fp; //文件指针 char str1[50],str2[50]; //定义两个字符串变量 int i; //定义一个整形变量 gets(str1); //获取从键盘输入的字符,保存到 str1 gets(str2); //获取从键盘输入的字符,保存到 str2 fp = fopen("f1801.txt", "w"); //以写入的方式 阅读全文
posted @ 2013-01-03 17:27 pythonschool 阅读(1564) 评论(1) 推荐(1) 编辑
摘要: 假设在一个对话框程序中,有两个文本框(IDC_EDIT_FILE1和IDC_EDIT_FILE2)和两个按钮(IDC_BTN_1和IDC_BTN_2),这两个文本框中要输入两个不同的文件名称,从而完成相应的操作(如比较两个文件的差异),我们不得不通过两个按钮来实现两次“打开文件”的过程(相信我,这个功能经常会使用到的)。此时,我们可以使用OnDropFiles功能。以下从不同角度(对话框、文本框)来完成这个工作。不管从何种角度,让我们先来了解一下OnDropFiles到底是何物。OnDropFiles是WINDOWS窗口的WM_DROPFILES消息的消息响应函数,值得注间的是,对于基于... 阅读全文
posted @ 2012-12-14 17:31 pythonschool 阅读(1070) 评论(0) 推荐(0) 编辑
摘要: // Change.cpp: implementation of the CChange class.////////////////////////////////////////////////////////////////////////#include "stdafx.h"#include "CodeChange.h"#include "Change.h"#ifdef _DEBUG#undef THIS_FILEstatic char THIS_FILE[]=__FILE__;#define new DEBUG_NEW#en 阅读全文
posted @ 2012-12-14 13:32 pythonschool 阅读(603) 评论(0) 推荐(0) 编辑
摘要: CString转int:非Unicode环境CString str("1234");char *ch = str.GetBuffer(str.GetLength());int num = atoi(ch);str.ReleaseBuffer();int转CString:非Unicode环境CString str;int num = 1234;str.Format("%d",num);不建议使用(LPSTR)(LPCTSTR)这样的转换,不安全,错误率高。 阅读全文
posted @ 2012-12-11 21:11 pythonschool 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 使用python,是因为他的美;以下说明常用的字符编码在python中的应用:s = "中国a"print repr(s) #输出原始字符 是以十六进制表示# '\xd6\xd0\xb9\xfaa'#Ansi字符串我们最熟悉,英文占一个字节,汉字2个字节,以一个\0结尾,常用于txt文本文件#Unicode字符串,每个字符(汉字、英文字母)都占2个字节,以2个连续的\0结尾#utf-8英文1个字节,中文3个字节s1 = s.decode('gbk') //以十六进制存储就是已经编过码的了 所以要解码#u'\u4e2d\u56fda&# 阅读全文
posted @ 2012-11-30 15:36 pythonschool 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 最近在写code时,需要频繁使用到stat函数,为了更好的容错和log,就需要利用好st_mode。ok, 先看一下struct stat的结构。struct stat {dev_t st_dev; /* device */ino_t st_ino; /* inode */mode_t st_mode; /* protection */nlink_t st_nlink; /* number of hard links */uid_t st_uid; /* user ID of ... 阅读全文
posted @ 2012-11-28 16:40 pythonschool 阅读(6338) 评论(0) 推荐(0) 编辑
摘要: MFC中的argc和argv参数在consloe程序中,通常用main(int argc,char*const*argv),自动就得到这两个参数,在MFC多文档程序中,需要用到这两个参数,直接使用__argc,__argv即可。 阅读全文
posted @ 2012-11-27 16:51 pythonschool 阅读(551) 评论(0) 推荐(0) 编辑
摘要: BOOL CCreateStatusBarDlg::OnInitDialog(){ CDialog::OnInitDialog(); // Add "About..." menu item to system menu. // IDM_ABOUTBOX must be in the system command range. ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX); ASSERT(IDM_ABOUTBOX < 0xF000); CMenu* pSysMenu = GetSystemMenu(FALSE). 阅读全文
posted @ 2012-11-27 13:51 pythonschool 阅读(485) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 10 下一页
刘华世的官方博客