linux 服务启动失败?

在/etc/rc.d/init.d/里面写个脚本test

执行service test start

结果提示:

env: /etc/init.d/test: No such file or directory

可是ls一下该文件却存在。

脚本看起来也没有问题。

原来,该脚本是从windows过去的,分行有问题。

用tr -d ‘\r’ < test >test1

将换行去掉。结果,就可以执行了。

 

ms vc++与web通信源码

服务器采用php完成,生成xml文件。
客户端采用C++完成,读取xml数据,再生成二进制数据,采用protocal buf 往android手机客户端发数据。这样可以节省大量访问网络的带宽。
C++代码采用libxml2和wininet库来访问网络和解析xml。
C++源码:
// testhttp.cpp : 定义控制台应用程序的入口点。
//

#include ”stdafx.h”
#include ”testhttp.h”
#include <WinInet.h>
#include <string>
#include <tchar.h>

#inc[......]

Read More ...

php 生成xml的问题

用php的DOMDocument生成了一段xml,但开头却有一空行。用libxml2分析xml时,提示:
noname.xml:2: parser error : XML declaration allowed only at the start of the document
<?xml version=”1.0″ encoding=”utf-8″?>
 
php代码类似:
global $pagecount;
$doc = new DOMDocument(“1.0″,”utf-8″);
header(“Content-Type: text/plain; char[......]

Read More ...