5 ms·
I was able to to it. Here's the source code "hello world.c": #include <stdio.h> int main(void) { puts("Hello, world!"); return 0;
by spc476 9y ago
I was able to to it. Here's the source code "hello world.c":
#include <stdio.h>
int main(void)
{
puts("Hello, world!");
return 0;
}
And here's the minimal Makefile to generate the output:
hello world:
Of course, I did have to swap out the ASCII SP (character 32) for the Unicode non-blank space (code 160) to get this to work, but hey, spaces!
- abhishekjha 9y ago>I did have to swap out the ASCII SP (character 32) for the Unicode non-blank space (code 160) How? EDIT: Ok, now I got it. Boy that was a wild ride.
- coldsauce 9y agoCould you explain how you did it?
- abhishekjha 9y agoReplacing breaking space with non-breaking space : 1. Set up your compose key on linux(Top right corner settings->system settings->keyboards->shortcut->typing->Compose key(choose an appropriate one)). 2. Whenever you need to type breaking space instead type (compose key + spacebar + spacebar). This puts a non-breaking space there instead. That's it. 3. Create file -> sudo nano hello(compose key + spacebar + spacebar)world.c 4. Paste the code to execute. 5. Makefile-> hello(compose key + space + space)world: 6. make 7. ./hello world (pressing tab will recognise the executable automatically). NOTE: Don't do this ever in any production code or just ever. This hack can take up hours to resolve and a lot of frustration which could have better been spent on fixing something meaningful. This is a frowned upon practice. The only cool part is that your directory can have two files with whose name look exactly the same.
- spc476 9y agoI did not do the method below. Instead, I wrote a script to generate the filename with the non-breaking space where I needed it. Edit: rewording and typos.
- abhishekjha 9y agoAny way I can see the script? Looks like I am still learning and ended up taking a longer route.
- spc476 9y agoIt's Lua 5.3: h = "hello" .. utf8.char(160) .. "world" f = io.open("Makefile","w") f:write(h,":\n") f:close() f = io.open(h .. ".c","w") f:write([[ #include <stdio.h> int main(void) { puts("Hello, world!"); return 0; } ]]) f:close() Pretty straightforward.