473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

redefining stdout/stderr

ashitpro
542 Expert 512MB
when I declare

#ifndef stdout
#define stdout 0
#endif

#ifndef FILE
#define FILE void
#endif

it gives me warning as "redefined in stdlib.h".
How can I prevent #include<stdio.h> or #include<stdlib.h>
for particular translation unit?
Aug 31 '12 #1
2 3921
johny10151981
1,059 1GB
this is how stdout is define.
Expand|Select|Wrap|Line Numbers
  1. #ifndef _STDSTREAM_DEFINED
  2. #define stdin  (&__iob_func()[0])
  3. #define stdout (&__iob_func()[1])
  4. #define stderr (&__iob_func()[2])
  5. #define _STDSTREAM_DEFINED
  6. #endif 
  7.  
if you set stdout to zeor your application will fail if you use printf function or scanf function or any function that print on standard output. It does not warn me? why?
Sep 1 '12 #2
ashitpro
542 Expert 512MB
I think I solved my problem by re-arranging the headers. By the way, my code can not be dependent on c-runtime. someone else will plugin their platform specific code. The reason, I was suppressing those "#defines" is that particular code is auto-generated by lex.
Sep 1 '12 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jan Knop | last post by:
Hello I am writing a Windows application where I need to redirect stdin, stdout and stderr from Python. to my application Is it a simple way of do it ? Has anyone done it using Winsock ?
1
by: Jacek Popławski | last post by:
Popen from subprocess module gives me access to stdout, so I can read it. Problem is, that I don't know how much data is available... How can I read it without blocking my program? example:...
4
by: ChokSheak Lau | last post by:
Hi, using popen() doesn't seem to give me any way to capture the stderr of the child process. does anyone know whether there is any way to capture these: 1. stdout 2. stderr 3. exitcode
37
by: nobody | last post by:
I am writing a framework that other developers will write plug-ins for. I would like for one of the features of the framework to be to intercept all text written to stdout/stderr and prepend...
2
by: Abhishek | last post by:
what are the STDUPDATE, STDERR, STDOUT and STDIN streams and how does one access these streams in C language. I am aware of the function fprintf(FILE *fp, char * format, char *s) which puts the...
0
by: Christoph Haas | last post by:
Evening, I'm having trouble with running a process through Python 2.4's subprocess module. Example code: ======================================================== def run(command): run =...
1
by: notanotheridiot | last post by:
Hi- I'm trying to exec some arbitrary code in one thread of an application and read anything it prints to stdout or stderr in another thread. My question is how? I've tried changing...
2
momotaro
by: momotaro | last post by:
Hello! am wondring if stdin, stdout and stderr are of any help since we can do the same thing using 'printf' for example: fprintf(stdout, "%s", message); is exactely the same as: ...
2
by: RossGK | last post by:
Just getting used to the PyDev environment in eclipse by playing with a few simple programs. I'm also using wxPython GUI stuff. I've noticed though that simple print commands in my code cause a...
8
by: subramanian100in | last post by:
The file stdio.h just contains extern FILE *stdin; extern FILE *stdout; extern FILE *stderr; When are the standard streams stdin, stdout, stderr initialiazed ? How are they initialiazed ? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.