UNIX板の皆様 閉鎖の危機にまた立ち上がってat UNIX
UNIX板の皆様 閉鎖の危機にまた立ち上がって - 暇つぶし2ch759:win32
07/01/13 03:06:33
とりあえず動くようだ。

// Visual C/C++ windows32 project
#include "stdafx.h"
#include <windows.h>
#include <stdio.h>
#include <shlobj.h>//needs shell32.lib

int main(int argc, char * argv[])
{
FILE * fdHosts;
char szSystemPath[MAX_PATH];
char szHostsPath[MAX_PATH];

SHGetFolderPath(NULL,CSIDL_SYSTEM , NULL, 0, szSystemPath);
sprintf( szHostsPath, "%s\\drivers\\etc\\hosts" ,szSystemPath );
printf( szHostsPath );
fdHosts = fopen( szHostsPath, "a" );//例外処理は省略
fprintf( fdHosts, "#\n" );
fprintf( fdHosts, "pc10.2ch.net 206.223.148.200\n" );
fprintf( fdHosts, "pc9.2ch.net 206.223.147.60\n" );
//のこりのサーバ
//
//
fclose( fdHosts );
return 0;
}


次ページ
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch