GoHacking.com: Ethical Hacking and Cyber Security
Home » C PROGRAMMING

Program To Print A String Without Using Any Output Statements

Submitted by on Friday, 30 November 20077 Comments

This program can be used to print a string without using any output statements such as printf, puts etc. However this program only works in 16-bit mode since it directly writes to VDU Memory

#include<stdio.h>
#include<conio.h>
char str[]=”Hello Srikanth”;
char far *v=(char far *)0xb8000000;
void main()
{
int i;
for(i=0;i<14;i++)
{
*v=str[i];
v+=2;
}
getch();
}


By using/following this site you agree to our Legal Disclaimer

7 Comments »

  • xor eax,eax said:

    if you use linux:

    int main(){
    char code[]= “\xeb\x18\x59\xb8\x04\x00\x00\x00\x31\xdb”
    “\xba\x18\x00\x00\x00\xcd\x80\xb8\x01\x00\x00\x00\x31\xdb”
    “\xcd\x80\xe8\xe3\xff\xff\xff\x49\x27\x6d\x20\x66\x6f\x72\x6d\x61″
    “\x74\x74\x69\x6e\x67\x20\x6d\x79\x20\x62\x72\x61\x69\x6e\x0a” ;
    int (*func)();
    func = (int (*)()) code;
    (int)(*func)();
    return 0;
    }

  • nice said:

    hey buddy that was awesome
    but please cn u also explain the logic

  • biswajit das said:

    this is not working it simply shows the 3 errors the error is illegal character so what i do

  • Srikanth (author) said:

    @ biswajit das

    This program works only on a 16-bit C/C++ compiler.

  • xyz said:

    plzz explain the logic behind this code..
    thank you!

  • Aldrin said:

    Hi sir am Aldrin, I want to improve my skills but i intrest in only c/c++. Other languages give litle strugle for me . How I Can?….
    But I hope I ‘ll DO …
    Pls Send U’r personal ideas for me…….

  • Mayur said:

    hi Sir
    I am khakhkhar mayur. I have one problem
    Sir i want formate in pen-drive using C language…
    plz give me source code in my e-mail id..

    i will wait for ur ans…

    Thanks

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.