Skip to content

Instantly share code, notes, and snippets.

View fortheday's full-sized avatar
🤩

magicpotato fortheday

🤩
View GitHub Profile
auto usHi = *(WORD *)"Hi";
// C++Builder code
struct sockaddr_in addr;
SOCKET s;
int i;
memset(&addr, NULL, sizeof(struct sockaddr));
addr.sin_family = AF_INET;
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_port = htons(0);
// 기본형
#include <shellapi.h>
#include <shlobj.h>
ShellExecute(Handle, "open", "http://magicpotato.com/p", NULL, NULL, SW_SHOWDEFAULT);
// [용주] 음...저건 이미 띄어진 익스플로어창이 있다면 거기서 뜨는 문제가 있고 무조건 익스플로어 새창을 띄어서 하고 싶다면 요론식으로....
{
ShellExecute(NULL, "open", "IEXPLORE.EXE", "http://magicpotato.com/p", NULL, SW_SHOW);
// (WindowsInternet + VCL + MP_LIB 사용)
//---------------------------------------------------------------------------
#include <vcl.h>
#include <wininet.h>
#include <stdio.h>
#include "mp_File.h"
#include "MainForm.h"
#pragma comment (lib, "wininet.lib")
//---------------------------------------------------------------------------
#pragma resource "*.dfm"
char buf[1024];
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), 0, buf, 1024, NULL);
MessageBox(NULL, buf, NULL, MB_OK);
printf("%zu %llu", sizeof(int *), (unsigned int)(((int *)0) + 2));
using namespace std;
void procArray(int intArr[])
{
}
void TestMain()
{
int intArr[] = { 1, 2, 3 };
procArray(intArr);
#define V(code) puts(#code); code;
V(int x = 3);
V(x = 4);
V(std::cout << x << std::endl);
#define DECL_STR(head, name) char *psz##head##_##name = #name
DECL_STR(Product, Potato);
DECL_STR(Product, Apple);
pszProduct_Apple;
pszProduct_Potato;
static void localFunc();// scope is same file
static int g_localInt; // scope is same file