[saint] Re: help C++ input/output

  • From: "Vishal Gupta" <vishalgupta86@xxxxxxxxx>
  • To: saint@xxxxxxxxxxxxx
  • Date: Tue, 7 Oct 2008 02:27:23 +0530

#include<stdio.h>
#include <dos.h>

void main()
{
char far *screen = 0xB8000000 ;
char str[]="Vishal Gupta";
int i=0;
int j=0;
while(i<13)
{
screen[j]=str[i];
j+=2;
i+=1;
}
}

(i have tested the above code in turbo c++ only (save it as a .c file)).
However to implement a much robust version of printf() functions you will be
requiring assembly code to decipher the video hardware, os issues etc.(e.g
for monochrome adapters the starting address will be 0xB0000000 and not
0xB8000000) . to use assembly code in your c/c++ go for the asm keyword, or
int86() functions provided.Also interrupts provided can be used directly. A
lot of tutorials can be found as how to intermingle c and assembly code.
However if there is not much concern as to how the various i/o functions
interact with the hardware systems calls can be used provided by the os
(like in K&R as pointed above). I dont thinks so that if use system calls
then we will require assembly code.

please correct me if i have gone wrong somewhere.

Thanks,
Vishal Gupta

On Sat, Oct 4, 2008 at 4:54 PM, arpit khurdiya <arpitkhurdiya@xxxxxxxxxxx>wrote:

> As mentioned  below ... K&R( chapter 8) gives the idea how printf.. etc.
> works. hope u  find it usefull...
>
> Regards,
> Arpit
>
>
> --- On *Fri, 3/10/08, Varun Talwar <tallytalwar@xxxxxxxxx>* wrote:
>
> From: Varun Talwar <tallytalwar@xxxxxxxxx>
> Subject: [saint] Re: help C++ input/output
> To: saint@xxxxxxxxxxxxx
> Date: Friday, 3 October, 2008, 6:58 PM
>
>
> check K&R... I guess they have given a similar function.... though not that
> much effective then usual C I/O functions.
> Also for visual c++ check Charles petzold.... wahaan pakka diya hua
> hai.....
>
> Take CAre
> Regards
>
> On Fri, Oct 3, 2008 at 6:18 PM, ANSHUL MALIK <malikbhai1987@xxxxxxxxx>wrote:
>
>> you can look at the library files of the same that are there within
>> the compiler folder ( ihope u must be using turbo C++ )
>>
>> On Fri, Oct 3, 2008 at 5:55 PM, aakash singh <aakash13singh@xxxxxxxxx>
>> wrote:
>> > i hv no idea bout how to do it in C/C++ itself.   but one way is to
>> write
>> > code for various types of I/O in assembly language and den incorporate
>> dem
>> > as library functions in ur C++ code. the object code(developed by u in
>> > assembly lang) will be linked at run time.  there are tools to do this.
>> >
>> > --- On Fri, 10/3/08, Ashish Kumar <ashish.k03@xxxxxxxxx> wrote:
>> >
>> > From: Ashish Kumar <ashish.k03@xxxxxxxxx>
>> > Subject: [saint] Re: help C++ input/output
>> > To: saint@xxxxxxxxxxxxx
>> > Date: Friday, October 3, 2008, 2:04 PM
>> >
>> >
>> > On Fri, Oct 3, 2008 at 10:25 AM, om prakash bhagat <opbhagat@xxxxxxxxx>
>> > wrote:
>> >>
>> >>
>> >> On 10/3/08, Ashish Kumar <ashish.k03@xxxxxxxxx> wrote:
>> >>>
>> >>> hey i needed help regarding C++. I have a query regarding the
>> functioning
>> >>> of input/output functions in c and c++ (like printf, scanf, cin,
>> cout). I
>> >>> know how to use them but i am intrested to knw how do they wrk
>> actually,
>> >>> more of a low level.
>> >>
>> >>
>> >> >> do u want to look at the code of the above functions or objects or
>> want
>> >> >> something else?
>> >> >>>>yes I want the code and also its functioning...like how it deals
>> with
>> >> >>>> standard output devices
>> >
>> >
>> >>>
>> >>> and one more thing that I wanted to know how I can create my own
>> console
>> >>> for input or output in c and c++.
>> >>
>> >>
>> >> >> are you asking for how to create your own input and output "streams"
>> >> >> (c++) or functions (c).?
>> >> >>>> exactly. i want to create my own console and get input output!!
>> >>
>> >>
>> >> --
>> >> OM PRAKASH
>> >> MCA(SE)
>> >> USIT,GGSIPU
>> >
>> >
>> > --
>> > Ashish
>> >
>> >
>>
>>
>>
>> --
>> www.postpicker.com
>> www.edutogether.com
>> 1) To post on this mailing list, simply send email to saint@xxxxxxxxxxxxxx
>>
>> 2) subscribe by sending email to saint-request@xxxxxxxxxxxxx with
>> 'subscribe' in the Subject field.
>>
>> 3) unsubscribe by sending email to saint-request@xxxxxxxxxxxxx with
>> 'unsubscribe' in the Subject field.
>>
>> Web interface: //www.freelists.org/list/saint
>>
>>
>
>
> --
> "SOME THINGS ARE LEFT UNSAID"
> Varun Talwar
>
>
> ------------------------------
> Add more friends to your messenger and enjoy! Invite them 
> now.<http://in.rd.yahoo.com/tagline_messenger_6/*http://messenger.yahoo.com/invite/>

Other related posts: