Sign in to follow this  
Nanook

stream width and function files

Recommended Posts

To questions: 1. what does "width of a stream" mean? 2. in my book it declears the functions in a header file and it includes it in the main source file.. thats ok.. but it also tells me to put the definitions of the function in another source file.. how does the compiler know that this source files are beeing used in the main source file?

Share this post


Link to post
Share on other sites
1 - I'm not sure what the width of a stream is without context, but if I were to guess, then I would say it is the size of the character type (you generally have two typedefs for char and wchar_t in the standard stream types, e.g. ifstream, wifstream).

2 - It doesn't. That's the point. The compiler does not need to know where the functions or defined or how they are implemented. That is the job of the linker. The linker links together all of the object files that were generated by the compiler. The compiler just need to know that these functions exist. For more information, see Organizing Code Files in C and C++.


jfl.

Share this post


Link to post
Share on other sites
1. sorry, should have specified more.. its the member of a stream.. but what does it do? like s.width(n)

2. ok.. so aslong as the source file with the function definition's is compiled once the compiler will remember them whenever I want to use them? aslong as I include the head file in the programs I'm making?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this