Using write() to display an integer in the output
So currently just about tried everything with the best of my knowledge to get this to work but I have been hitting a wall it seems.
I have tried casting write(1,(char) len, 1); tried passing it without casting, tried to make a pointer pointing to it and then passing that through but no luck empty space where the number should appear. I know that len is correct because of printf... but the goal is to not use printf just write() and not putchar, or >> and im having no luck finding any solutions.
#include <stdio.h>#include <string.h>
int i, len;
char name, length;
write(1,"Enter your last name: ",21);
len = read(fileno(stdin),name,20);len--;name[len] = 0;
write(1,"Name entered is ",16);
write(1," length is ",11);
// !!!!THIS PART!!! //
// My attempt to work around with no luck //
len_str = len;
len_str = 0;
write(1,". \n", 3);
//Clearly works here//
This is only a section of the code without my comments (sorry) just trying to find a solution to the writing issue, maybe i missed something and a source of where i can go to find the answer could be of help (or a solution :) ), thanks!