0

I have been learning c++ (not from school, I do everything at home, this is my third high level OOP language) for a while now and the tutorials (cplusplus.com) I have seen only show the use of the iostream header. I want to become familiar with the stdio.h header, as it is something to learn, and seems to be a little better than the iostream header.

I have not been able to find a good reference for the use of stdio.h

I see reference that show the commands, but nothing in depth.

Such as it will show the commands printf(),scanf(), etc, but it will not go into detail with things such as: printf(%i, a); printf(%s, b);

I have figured out by examples that the %i/%d is for integers and so on, and some others. I was just curious if there was a reference that goes more into detail like the above that I could check out to better my understanding and use of the stdio.h header.

Thanks in advance, -Ninjex

Ninjex
  • 1
  • 2
    http://en.cppreference.com/w/c – hmjd Jan 27 '13 at 13:54
  • 1
    `` is C, not C++ - you could try reading any good book or tutorial on C... – Paul R Jan 27 '13 at 13:54
  • 1
    It could be because the `stdio.h` stuff is C, so you might want to look in C references. BTW on a *nix terminal, I can just type "man printf". – juanchopanza Jan 27 '13 at 13:55
  • 1
    `stdio.h` is a C Standard Library header, not a C++ header. Although it is available, the C++ Standard Library provides its own equivalent, `cstdio`. However, much of the content of `cstdio` has been replaced by more idiomatic C++ library headers, such as `iostream`. – Joseph Mansfield Jan 27 '13 at 13:56
  • 1
    @juanchopanza man 3 printf – farmer1992 Jan 27 '13 at 13:57
  • Both http://www.cplusplus.com/reference/cstdio/printf/ and http://en.cppreference.com/w/c/io/fprintf include a full reference of the printf format string. – harpun Jan 27 '13 at 13:57
  • @juanchopanza or on any other machine [use the internet](http://linux.die.net/man/3/printf) – leemes Jan 27 '13 at 14:03

1 Answers1

3

In general stdio.h should be used if writing C and the advice is to use iostream when writing C++ applications. Both link to references you can use. Here's a link to some general C++ guidelines.

Konstantin Dinev
  • 34,219
  • 14
  • 75
  • 100
  • Thank you all for the responses, I was aware that stdio.h was for C! I was told that by using stdio.h, it would be better for me, from some anonymous people online. I kind of felt different about this myself. I am also on a *nix system and the man options seems like it will come in handy, if I wish to learn this now that I know it will not be as efficient. – Ninjex Jan 27 '13 at 14:18
  • 2
    You shouldn't believe everything anonymous people on the Internet tell you. :-) – Bo Persson Jan 27 '13 at 17:47