473,405 Members | 2,334 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

File Processing Problems

Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?

Apr 10 '07 #1
6 2652
ldb.jr wrote:
Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?
Try fstream::clear() between the close and reopen.
Apr 10 '07 #2
On Apr 10, 6:48 pm, red floyd <no.s...@here.dudewrote:
ldb.jr wrote:
Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?

Try fstream::clear() between the close and reopen.
Ah. worked. Cheers good sir...been stuck on that for hours. Thanks!

Apr 10 '07 #3
ldb.jr wrote:
Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?

Show us the code, a complete, minimal program that demonstrates the
problem.


Brian
Apr 10 '07 #4
On Apr 10, 7:27 pm, "Default User" <defaultuse...@yahoo.comwrote:
ldb.jr wrote:
Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?

Show us the code, a complete, minimal program that demonstrates the
problem.

Brian
problem solved already, but thanks anyway

Apr 10 '07 #5
ldb.jr wrote:
On Apr 10, 6:48 pm, red floyd <no.s...@here.dudewrote:
>ldb.jr wrote:
>>Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?
Try fstream::clear() between the close and reopen.

Ah. worked. Cheers good sir...been stuck on that for hours. Thanks!
This doesn't appear to be in the FAQ, and it probably should be.
Apr 11 '07 #6
The same problem i faced once.
1.Opened a file
2.read then closed
3. then open another file, not working properly
gcc_2.95.3 was working well but it failed with gcc_3.2.3, so i used
clear() with 3.2.3
ldb.jr wrote:
Hey guys,
Wonder if someone out there could give me a hand. Working on a parser
with C++ and I am scanning a text file filled with source code,
outputting the recognized tokens into another text file and then
attempting to reopen the output file to read the tokens. The second
open, however, keeps failing. I am using the fstream.close() function
on both the in and out stream but the reopen keeps failing. Any ideas?
Apr 11 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is...
19
by: Peter A. Schott | last post by:
I've got a file that seems to come across more like a dictionary from what I can tell. Something like the following format: ###,1,val_1,2,val_2,3,val_3,5,val_5,10,val_10...
1
by: DJTB | last post by:
zodb-dev@zope.org] Hi, I'm having problems storing large amounts of objects in a ZODB. After committing changes to the database, elements are not cleared from memory. Since the number of...
6
by: soren juhu | last post by:
Hi, I am developing a C Program for reading over a million files of size 1 kilobytes each and sending the contents to another program using some middle ware. I need some help on designing the...
3
by: News | last post by:
Is it possible to delete a file by copying it to the "bit bucket" or "null device"? Back in my youth when I live in VMS-land you could delete a file by copying it to NL: ========== I have...
9
by: JimmyKoolPantz | last post by:
IDE: Visual Studio 2005 Language: VB.NET Fox Pro Driver Version: 9.0.0.3504 Problem: I currently have a problem altering a DBF file. I do not get any syntax errors when running the program. ...
29
by: list | last post by:
Hi folks, I am new to Googlegroups. I asked my questions at other forums, since now. I have an important question: I have to check files if they are binary(.bmp, .avi, .jpg) or text(.txt,...
1
AdrianH
by: AdrianH | last post by:
Assumptions I am assuming that you know or are capable of looking up the functions I am to describe here and have some remedial understanding of C programming. FYI Although I have called this...
28
by: n00m | last post by:
Both codes below read the same huge(~35MB) text file. In the file 1000000 lines, the length of each line < 99 chars. Stable result: Python runs ~0.65s C : ~0.70s Any thoughts?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.