?
Solved

STDIN

Posted on 2003-11-02
2
Medium Priority
?
413 Views
Last Modified: 2010-04-15
Hi

I'm a fairly new programmer so go easy on me!! , but my question is this:

I have got to write a driver for a simple text editor  program. One of the pascal files in the program has this code:

if (feof(STDIN))
  *c = ENDFILE;
else
{
fread(&ch, sizeof(ch), 1, STDIN);

if (feof(STDIN))
  *c = ENDFILE;
else
*c = ord(ch);
}

return *c;

Now, I know there is not much information here but it is supposed to be a text copier of some sort but when I call this file from the driver, STDIN is always NULL and so throws and error. Now I always thought that STDIN was input from the keyboard but I have never actually used it before in this context. This means that I cannot understand how it works... arrrghhh!!
Do I need to link STDIN to the keyboard somehow???
Do I need to link it to a file in this respect (dont know how to do this either)
Just what is going on .. why is it there :-(

the function is called from a C file driver.

Please help. I will do my best to provide any more info if required. But I havnt got a lot.

Thank you
Dave
0
Comment
Question by:Red_Dash_Dave
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 6

Accepted Solution

by:
Ajar earned 200 total points
ID: 9668870
The solution is

#include <stdio.h>

// and instead of    STDIN  use stdin

stdin is linked to the keyboard  readily


0
 

Author Comment

by:Red_Dash_Dave
ID: 10272991
Sorry it took so long to accept your answer.

Thanks for your help :)
Dave
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you thought about creating an iPhone application (app), but didn't even know where to get started? Here's how: ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ Important pre-programming comments: I’ve never tri…
This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use switch statements in the C programming language.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question