Created
May 22, 2013 08:11
-
-
Save kagamilove0707/5626006 to your computer and use it in GitHub Desktop.
クロスプラットホームでURLからブラウザを起動する関数ですー>ω<
ただしOS Xでは動作確認していません、どなたか確認できたら連絡よろしくですー(-ω-)/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "openurl.h" | |
#ifdef _WIN32 | |
#include <windows.h> | |
#else | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#endif | |
void openUrl(const char* url) { | |
#ifdef _WIN32 | |
ShellExecute(NULL, "open", url, NULL, NULL, SW_SHOW); | |
#endif | |
#ifdef _linux | |
char s[1000]; | |
memset(s, 0, 1000); | |
sprintf(s, "xdg-open %s &",url); | |
system(s); | |
#endif | |
#ifdef __APPLE__ | |
char s[1000]; | |
memset(s, 0, 1000); | |
sprintf(s, "open %s &", url); | |
system(s); | |
#endif | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
void openUrl(const char* url); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment