473,386 Members | 1,773 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,386 software developers and data experts.

printf dont print anything

1,059 1GB
Around 3 years ago I got a problem. It was interesting for me, so I solved it. Compiler was turbo C/c++ 3.0. That is very old compiler.

That program had very poor memory management as I can recall(I dont have the source code right now). It used recursive function(to implement backtracking). The problem was after running the entire program the result(not display) used generated correctly(checked thousand time by debugging) but when i tried to print that array I never saw any output in the display.

I can guess stupid memory management has to do something with it. I actually wanna know what can be possible mistake where printf function wont print anything.
Jan 20 '10 #1
3 2952
donbock
2,426 Expert 2GB
In general, if nothing comes out when you call printf() the likely problems are:
  • stdout usually [always?] defaults to buffered I/O. This means that printf output goes into a memory buffer. To get the output out of the buffer and onto the monitor screen you either have to call a flush function or you need to print a newline character. This is by far the most common problem I've seen.
  • The format string is not consistent with the variable argument list. However, this error is more likely to result in garbage output than no output.
  • Something is wrong with the device driver associated with stdout.
  • Something is wrong with the connection between the computer and the monitor associated with stdout.
  • Something is wrong with the monitor associated with stdout.
printf has a return value indicating whether it thinks it succeeded or failed. You can check the return value -- it can help with the debugging to know whether printf is aware of a problem.
Jan 20 '10 #2
Banfa
9,065 Expert Mod 8TB
How about some redirected stdout to an alternate device without you being aware.
Jan 20 '10 #3
johny10151981
1,059 1GB
All of your answers make lot of sense. I was using simple desktop computer with one output device(crt monitor), Intel Pentium III processor with intel mother board. Installed OS was windows XP, I can recall.
Jan 20 '10 #4

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

Similar topics

6
by: Robert Ferrell | last post by:
I'm trying to "extend" Python by writing a bit of C code. I followed the example in the Python documentation, and almost everything works fine. I can build a DLL, fire up an interactive Python...
11
by: Pontus F | last post by:
Hi I am learning C++ and I'm still trying to get a grip of pointers and other C/C++ concepts. I would appreciate if somebody could explain what's wrong with this code: ---begin code block--- ...
8
by: aditya | last post by:
hi, Can anybody please tell me that how the following printf(...) statement works- main(){ int d=9; printf("%d",printf("%d")); return 0;
7
by: teachtiro | last post by:
Hi, 'C' says \ is the escape character to be used when characters are to be interpreted in an uncommon sense, e.g. \t usage in printf(), but for printing % through printf(), i have read that %%...
12
by: baumann | last post by:
hi all, printf("%c",b) doesn't work properly. #include <stdio.h> int a , b; char d, e; char * p; float f; int main(int argc, char* argv) {
19
by: v4vijayakumar | last post by:
why the following statement dumps the core(Segmentation fault)? printf("%s\n", __FILE__);
25
by: Podrzut_z_Laweczki | last post by:
Hello, I have question (or 2 :)). Is that true that for a large data using scanf/printf instead of cin/cout makes that the program runs faster? And if it is, is it legal to mix scanf/printf with...
6
by: ericunfuk | last post by:
printf("hello"); write(1,"hello",5); Are these two have the same effect?Only the 2nd one work for me sometimes?Are there situations that I can only use write() instead of printf()? Thanks
7
by: Avaenuha | last post by:
Hi, It appears my program can't get past a particular printf() statement. Code excerpt: printf("Sales Report\n--------------"); printf("Testing code - pre loop entry"); while(category !=...
15
by: singhraghvendra | last post by:
Hi I have a function as below void print(char* str) { printf(str); } now the user of the function can pass anything as the argument for
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.