Home » C SOURCE CODES

Program To Print A String Without Using Any Output Statements

Submitted by Srikanth on Friday, 30 November 20075 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();
}

Popularity: 1% [?]


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

Subscribe to GoHacking.Com


Enjoyed this article?
Subscribe to GoHacking.Com and get daily updates in your email for free

5 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!

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.