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: 1795
Discussions: 188,401, Posts: 2,243,599, Members: 232,629
Old December 5th, 2004, 07:27 PM   Digg it!   #1 (permalink)
Member
 
Join Date: Nov 2004
Posts: 56
Angry
why wont this work

this is simple, its just supposed to print that stuff to the output fle.
call the function and print to the file.
the program runs but nothing is printed

#include <fstream.h>

int main()
{
void print();

ofstream fout;

fout.open("a:/out.txt");

void print();

fout.close();

return 0;
}

void print()
{
ofstream fout;
fout<<"spongebob\n";
fout<<"cs1318.004\n";
}

boogieman063 is offline   Reply With Quote
Old December 5th, 2004, 07:35 PM     #2 (permalink)
Ultimate Member
 
paul9's Avatar
 
Join Date: Aug 2003
Location: Gateshead U.K.
Posts: 8,838
Send a message via MSN to paul9 Send a message via Yahoo to paul9
a:/out.txt
should that be
a:\out.txt ?
backslash instead of forward slash.

paul9 is offline   Reply With Quote
Old December 5th, 2004, 07:37 PM     #3 (permalink)
Ultimate Member
 
paul9's Avatar
 
Join Date: Aug 2003
Location: Gateshead U.K.
Posts: 8,838
Send a message via MSN to paul9 Send a message via Yahoo to paul9
also, if
spongebob\n
and
cs1318.004\n
include the \n as a command line switch, then you have probably reversed those slashes, too.

paul9 is offline   Reply With Quote
Old December 5th, 2004, 07:57 PM     #4 (permalink)
Member
 
Join Date: Nov 2004
Posts: 56
the slashes are supposed to foward, im using dev c++ i dont know why its like that, but its either two backslashes or one foward slash.
boogieman063 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
halo 4 xbox help not working squik-man General Gaming Discussion 19 January 18th, 2004 07:02 PM
compaq presario 4540 mhoule Technical Support 6 August 16th, 2003 05:52 AM
Burned cd not working on cd players MrMcGriddle General Tech Discussion 2 August 13th, 2003 06:17 PM
multi-dsiplay screwed up when switching to win 2k from win 98 thePh@r@oh Graphics Cards and Displays 18 February 7th, 2003 11:54 PM
Confusion in hooking up wires to MB mikey76 Motherboards 3 October 30th, 2002 11:43 AM

Most Active Discussions
Is It Just Me? (2906)
Unarmed man on his stomach shot by .. (6)
Misery Loves Company... (2144)
New Build ( Finally ) (6)
CPU wont boot (7)
Building a gaming computer advice (5)
I think I just killed my computer w.. (24)
Folderchat Weekday thread (444)
Upgrading RAM (6)
Recent Discussions
What is the best external enclo.. (0)
Partition Magic 7.0 (Unallocate.. (17)
For cheap price and good qualit.. (1)
Left 4 Dead Small Freezes (3)
RCA 52Inch HDTV wont turn on (4)
wishin i could edit my aol prof.. (0)
Sporadic internet connectivity (2)
Assassins Creed PC Problems (40)
I think my PSU is dieing (1)
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 03:37 AM.
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