Can I use secrets in C?

Question:
Is it possible to use secrets in C? If so, how?

2 Likes

getenv, based off this: Retrieving environment variables in C | JoeQuery

3 Likes

Thanks for the quick response!

1 Like

What are you making?

1 Like

Trying to make a phonebook.

Make sure you make sure getenv(2) didn’t return NULL before handling data, otherwise you’ll get some nasty bugs when environment variables you expect to have aren’t set!

2 Likes

“Make sure you make sure” lol

I’m just trying to get REPL_OWNER. For some reason It’s saying wertyQwerty54 instead of QwertyQwerty54 though.

Huh! Could you add me to the repl?

nerver mind it’s working, but the first character I’m printing seems to be getting cut off. I invited you

I tested in my ZNC’s *shell, and that didn’t happen for me

[7:33:10 PM] <h> (echo "#include <stdlib.h>";echo "#include <stdio.h>";echo 'int main(){printf("%s\n", getenv("REPL_OWNER"));}';)>/tmp/test.c;gcc /tmp/test.c -o /tmp/test&&/tmp/test
[7:33:11 PM] <*shell> 9pfs
[7:33:11 PM] <*shell> znc$
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.