How do I complete this C (assembly) character to hexadecimal and binary conversion code? -


i need write assembly program in enter "abcd" , gives me hexadecimal , binary equivalents each letter on it's own line. need use following in code:

setmode(fileno(stdin), o_binary); 

i have this, far, can't seem compile it. missing, , can change? thank you. far, have this:

    int main(void);     {         char c;        int numchars = 0;         setmode(fileno(stdin), o_binary);        while(read(stdin_fileno, &c, ') > 0){        ++numchars;        }        printf("%d\n", numchars);         return 0;        } 

three problems:

no header files. need stdio.h printf , fileno, , io.h read , setmode (setmode windows function; on linux, include unistd.h read).

this:

int main(void); 

is function declaration, not definition. rid of ;:

int main(void); 

finally:

while(read(stdin_fileno, &c, ') > 0){ 

you have ' there should value number of bytes read. should 1:

while(read(stdin_fileno, &c, 1) > 0){ 

Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -