Skip to content

Instantly share code, notes, and snippets.

@tr4g
Created Jul 7, 2020
Embed
What would you like to do?
Como ver si estoy en WSL1 o WSL2
#include <stdio.h>
#include <string.h>
#include <sys/utsname.h>
int main(void)
{
struct utsname buf;
memset(&buf, 0, sizeof buf);
int ret = uname(&buf);
if (ret == 0)
{
if (strstr(buf.release, "Microsoft"))
printf("WSL1\n");
else
printf("WSL2\n");
}
else
printf("uname error\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment