home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Join TechIMO for Free!
Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
Reply Get bargains at  »  Dealighted.com
 
Thread Tools
Currently Active Users: 2891
Discussions: 188,379, Posts: 2,243,461, Members: 232,607
Old August 16th, 2002, 01:37 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Jun 2002
Location: Manitoba, Canada
Posts: 77
Passing parameters

If I create an ofstream fout in main,

and I want to use it in a method...say process_line

how do I pass it as a parameter?

process_line(fout) ??

void process_line(ofstream &fout){...

I seem to be havin a little trouble with this one... guess that's what happens when you use it once and then try to pull it up 2years later without the program that I made here.

Ram09

Ram09 is offline   Reply With Quote
Old August 16th, 2002, 05:14 PM     #2 (permalink)
Ultimate Member
 
strangerstill's Avatar
 
Join Date: Oct 2001
Posts: 1,542
Well, it always works to pass by reference:

process_line(&fout)

void process_line(ofstream *fout) {...

strangerstill is offline   Reply With Quote
Old September 4th, 2002, 04:11 PM     #3 (permalink)
Member
 
AirmanRules's Avatar
 
Join Date: Sep 2002
Location: Cayey, Puerto Rico
Posts: 67
Send a message via MSN to AirmanRules
Streams always passes by reference
THey are objects so you don't return them, so the function should be void.

AirmanRules is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Most Active Discussions
Is It Just Me? (2885)
The United States Debt (20)
Looks like Burris will get his Sena.. (8)
I think I just killed my computer w.. (24)
Upgrading RAM (5)
Folderchat Weekday thread (439)
Antec 300 bulk purchase? (11)
Worth the upgrade?? (14)
Help with an Ati Radeon HD 4850 512.. (25)
Recent Discussions
Best digital camera for under 2.. (14)
Help with an Ati Radeon HD 4850.. (25)
Install Problem for Windows Def.. (0)
New Build ( Finally ) (1)
dual monitors wont boot (0)
Folderchat Weekday thread (439)
MSN Hotmail Down??? (7)
Laptop waking up itself (0)
CPU wont boot (3)
Blackberry Storm, Gears of War .. (1)
Core 2 Quad Q9550 system (3)
COWBOOM Ripoff! Used Laptop w/$.. (4)


All times are GMT -4. The time now is 08:38 PM.
TechIMO Copyright 2008 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28