User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C section within the Software Development category of DaniWeb, a massive community of 374,011 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,783 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C advertiser:
Views: 359 | Replies: 18 | Solved
Reply
Join Date: Apr 2008
Posts: 14
Reputation: ohhmygod is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
ohhmygod ohhmygod is offline Offline
Newbie Poster

Re: Need help on my assignment !!! - about file streams :((

  #11  
May 15th, 2008
I've fixed the silly problems b4, now the codes can be compiled, but it doesn't hold the windows as expected. So i guess it doesnt scan in properly (i need to keep windows opening, as its part of my assignment :p )

You can try to compile it , it will close straight away.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,182
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 822
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Need help on my assignment !!! - about file streams :((

  #12  
May 15th, 2008
you have to put a line at the end of main() to keep the window from closeing. Add a getchar() will do it.
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Join Date: Apr 2008
Posts: 14
Reputation: ohhmygod is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
ohhmygod ohhmygod is offline Offline
Newbie Poster

Re: Need help on my assignment !!! - about file streams :((

  #13  
May 15th, 2008
I do have getchar() at the end of my code ><
Last edited by ohhmygod : May 15th, 2008 at 10:31 am.
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,556
Reputation: niek_e is a jewel in the rough niek_e is a jewel in the rough niek_e is a jewel in the rough niek_e is a jewel in the rough 
Rep Power: 8
Solved Threads: 157
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: Need help on my assignment !!! - about file streams :((

  #14  
May 15th, 2008
That's very strange... AD is right a getchar() should do the trick.
Try replacing the getchar() with:
while(getchar()!='q'){}
Now you'll have to enter a 'q' and 'enter' to quit
"= != =="

PM's asking for help will be ignored..
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,182
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 822
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Need help on my assignment !!! - about file streams :((

  #15  
May 15th, 2008
I just compiled and ran your program in Dev-C++ and the window didn't close on me. I also ran it from command prompt and it worked there too.
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,556
Reputation: niek_e is a jewel in the rough niek_e is a jewel in the rough niek_e is a jewel in the rough niek_e is a jewel in the rough 
Rep Power: 8
Solved Threads: 157
niek_e's Avatar
niek_e niek_e is offline Offline
Posting Virtuoso

Re: Need help on my assignment !!! - about file streams :((

  #16  
May 15th, 2008
Another thought comes to mind:
Where is your input.txt? Is it in the same folder as the executable? If not: crash
"= != =="

PM's asking for help will be ignored..
Reply With Quote  
Join Date: Apr 2008
Posts: 14
Reputation: ohhmygod is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
ohhmygod ohhmygod is offline Offline
Newbie Poster

Re: Need help on my assignment !!! - about file streams :((

  #17  
May 15th, 2008
@ niek: i tried ur method, doesnt work either.
@ AD: can u please post the source code and the file u compiled on here ? I use dev-c++ too and doesnt work ><

---- EDITED -----

oh wait. I got it working for some reasons. I need to see if the thing really works :p BRB
oh and I finally realized that when u compiled with dev C++ and press run in the code, it wont run, have to go to the actual folder to run it.
Last edited by ohhmygod : May 15th, 2008 at 10:45 am.
Reply With Quote  
Join Date: Apr 2008
Posts: 14
Reputation: ohhmygod is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
ohhmygod ohhmygod is offline Offline
Newbie Poster

Re: Need help on my assignment !!! - about file streams :((

  #18  
May 15th, 2008
Thank you guys for helping me. I finally figured everything out. Now im working on the rest of my assignment . Again, thanks a lot !!!!!! This is a hell long assignment and its due monday hehe. :p

(and i'll fix the void main(void) too =] "The lecturer said its OK" ! :p i'll just do the standard one)
Last edited by ohhmygod : May 15th, 2008 at 10:59 am.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,182
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 34
Solved Threads: 822
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Need help on my assignment !!! - about file streams :((

  #19  
May 15th, 2008
>>@ AD: can u please post the source code and the file u compiled on here ? I use dev-c++ too and doesnt work ><
I used exactly the same source code that appears in post #7 in this thread, except I fixed the void main. I didn't use a data file so it didn't actually read anything. But the program didn't crash as niek_e suspected.
Last edited by Ancient Dragon : May 15th, 2008 at 11:07 am.
'Politics' is made up of two words, 'poli,' which is Greek for 'many,' and 'tics,' which are blood-sucking insects.
- Gore Vidal
Being ignorant is not so much a shame as being unwilling to learn. - Benjamin Franklin
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

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

 

DaniWeb C Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C Forum

All times are GMT -4. The time now is 10:48 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC