file/filetype.c #include "apue.h"intmain(int argc, char *argv[]){ int i; struct stat buf; char *ptr; for (i = 1; i < argc; i++) { printf("%s: ", argv[...
分类:
其他好文 时间:
2014-07-18 23:38:27
阅读次数:
412
file/fileflags.c #include "apue.h"#include intmain(int argc, char *argv[]){ int val; if (argc != 2) err_quit("usage: a.out "); if ((val = fcntl(atoi(a...
分类:
其他好文 时间:
2014-07-18 23:28:24
阅读次数:
203
这次的题目很经典。
1、Hermite Polynomials
2、求两个整数最大公约数
3、ATOI
4、可变参数列表的使用
具体的题目在这里:
题目请见 http://download.csdn.net/download/wangpegasus/5701765
1、
int hermite(int n, int x)
{
if (n < 1)
{
return 1;...
分类:
其他好文 时间:
2014-07-18 22:05:09
阅读次数:
234
UCHAR recordlenthrecordlenth与整形int比较时不用atoi转换recordlenth。若转换出错3.lseek函数所需头文件:#include #include/*定义了off_t,pid_t等类型*/函数原型:off_tlseek(intfd,,off_toff...
分类:
其他好文 时间:
2014-07-16 19:02:58
阅读次数:
282
我们在linux常常用到一个程序需要加入参数,现在了解一下perl中的有关控制参数的函数.getopt.在linux有的参数有二种形式.一种是--help,另一种是-h.也就是-和--的分别。--表示完整参数.-表示简化参数.
在perl中也分这二种.
Getopt::Std模块的功能: 初始化perl命令行中所接受的参数,简化了命令行参数的解析。 简化参数例子:
#!/usr...
分类:
其他好文 时间:
2014-07-16 16:16:50
阅读次数:
245
把字符串转换为整数 代码(C)本文地址: http://blog.csdn.net/caroline_wendy题目: 写一个函数StrToInt, 模拟atoi的功能, 把字符串转换为整数.需要考虑异常处理, 正负数, 还有Int的最大值(0x7FFFFFFF)和最小值(0x80000000)等情况.代码:/*
* main.cpp
*
* Created on: 2014.7.12
...
分类:
其他好文 时间:
2014-07-16 13:43:13
阅读次数:
177
1.memcpy函数的原型: void* memcpy(void* dest,cosnt void* src,size_t n); 返回值:返回dest; 功能:从源内存地址src拷贝n个字节到dest内存地址. 这里必须要求源地址的内存和目标地址的内存没有覆盖,如果有覆盖结果是未定义的.#incl...
分类:
编程语言 时间:
2014-07-14 21:41:00
阅读次数:
274
System.Environment类允许我们通过不同的静态成员获得大量的有关运行.net应用程序的操作系统的细节。usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Collections;
namespace命令行参数
{
classProgram
{
staticintMain(stri..
分类:
其他好文 时间:
2014-07-14 12:37:28
阅读次数:
192
PHP编程中经常需要用到一些服务器的一些资料,特把$_SERVER的详细参数整理下,方便以后使用。
$_SERVER['PHP_SELF'] #当前正在执行脚本的文件名,与 document root相关。
$_SERVER['argv'] #传递给该脚本的参数。
$_SERVER['argc'] #包含传递给程序的命令行参数的个数(如果运行在命令行模式)。
$_SERVER['GATEW...
分类:
Web程序 时间:
2014-07-13 18:54:34
阅读次数:
323
在Linux下编程习惯了使用命令行参数,故使用VS2010时也尝试了一下。
新建项目,c++编写程序如下:
#include
#include
using namespace std;
int main(int argc,char*argv[])
{
ifstream fin(argv[1],ios::in);//输入方式打开文件
//ifstream fin;fin.open(argv...
分类:
其他好文 时间:
2014-07-12 21:01:31
阅读次数:
296