[Solved] How to keep printing from a location even after encountering null in C?


A string is an array of characters which end with \0. So printf() will not work. To output an array of characters you can use fwrite().
fwrite() has this declaration:

size_t fwrite ( const void * ptr, size_t size, size_t count, FILE * stream );

ptr points to the data you want to output, size*count is the size of the object you want to output, the return value is the number elements written, normally same as count. If it is different from count, you can check for errors with feof().

You can use stdout for stream when you want to print to stdout. But keep in mind that printing binary data to the terminal is not a good idea because it can mess up the terminal. A better idea is to write to a real file or encode it in something like hexadecimal, but then you have to write your own encoding function.

I do not think it is a good idea to run your programs with root privileges, which i assume you do because you use sudo, when you do not understand the basics of c programming. It is better when you learn a bit more before you give your programs the permissions to break you OS.

1

solved How to keep printing from a location even after encountering null in C?