I'm in a Data Structures class (in Java) this semester, but we're doing a lot of parsing on text files to populate the structures we design. The focus is on the structures themselves, not on parsing algorithms. I feel sort of weak in the area and was wondering if anyone could point me to a book or site on the subject. Design patterns,...
Hi. How can I delete the whole lines which included both subStr1 and subStr2 in a big file and save as a new smaller file.
Part of my file content below.
12-23 20:27:35:265 GetVariable [Tunnel] INFO iVid = 536876042 data [Reruen] = System.Object[]
12-23 20:27:35:265 GetVariable [Tunnel] INFO iVid = 536876043 data [Reruen] =...
Hi,
i want to delete a file present in directory on the server. I have tried following code but code inside the file.exist never runs. It always skips it showing me that file does not exist. But file is present. can smone please help me. Thanx in advance
string filename = "Template\\copy.jpg";
if(System.IO.File.Exists(filename)...
while 1:
text_file = open("write_it.txt", "w")
word = input("Please add to a text file: ")
What else do I need to add to make my code run properly?
...
We have an application that reads in a flat file and parses out the data. This file contains no header information or total data with which to do a checksum. So I would like to create test cases to make sure our application properly handles "incomplete" files.
Is there a way to create a flat file with no EOF marker? Perhaps a tool ...
I am using the Apache Commons Uploader package, and I am trying to read a file that is being uploaded. I have a FileItem object.
The first few lines of the file are ASCII and I want to be able to read them and extract the metadata that is contained in them. What is the best method/pattern to go about doing this.
...
I have a part of a code that does the following: It reads in sentences from a file in a particular format, puts them in a vector. To probe whether the strings in the vector are stored correctly, I put debugging cout statements. I found that the last string member member of the vector is "". Why is this so? The file I am reading from ends...
Hi,
I receive Files in a Folder at say 2 secs interval from a host machine over " a TCP/IP network" at some Port X. I need to have a service / watcher which will copy these Files to other location. I tried FileSystemWatcher, but it seems that the "Created event" of the watcher gets fired as soon as a byte is getting written to disk.
Wh...
BufferedWriter out = new BufferedWriter( new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream("out.txt") ) ) );
So let me see if I understand this: A byte output stream is opened for file "out.txt". It is then fed to a buffered output stream to make file operations faster. The buffered stream is fed to an output str...
Hello,
I've been running game theory simulations in NetLogo and I now have lots data files, containing cross-tabulated data - each column store a value of a different variable, and there are c. 1000 rows containing the data. I'm trying to write a programme that will take these files and calculate the mean value for each column.
I have ...
Hi,
I am trying to read some text from a file and write it to another using open(), read() and write().
This is my open for the file-to-write-to (I want to create a new file and write into it):
fOut = open ("test-1", O_RDWR | O_CREAT | O_SYNC);
This is setting file-permissions to something I don't understand at all. This is the outp...
Hi,
Is there a function in c++ that works like the getdelim function in c? I want to process a file using std::ifstream object, so I cannot use getdelim here.
Any help would be much appreciated.
Thanks.
...
Hi,
how do I check for end-of-file using the string::getline function? Coz, using .eof() is not recommended as it wont signal eof until I attempt to read beyond eof.
...
Let's say I have a structure
-bin/com/abc/A.class
-src/com/abc/A.java
-config/info.txt
How to address the file info.txt from A class?
Should we use "user.dir" property or "config/info.txt" so that it would work ?
I'll compile this into the jar and after that
the jar will be used from the servlet,
but I don't think that's important
cau...
I'm doing a simple exercise from a book and I'm a little bit confused with how the java function parseInt works. I have read a line from an input file, used the StringTokenizer to split it and now I want to parse each part as an integer.
I have checked in the watch window that the input of the parseInt function is indeed a string which ...
Why does this code produce the warning?
FILE* my_open_file(char* filename)
{
FILE* fp=fopen(filename,"r");
if(fp==NULL)
{
perror("Error opening file");
return -1;
}
return fp;
}
asdf.c: In function ‘my_open_file’:
asdf.c:9: warning: return makes
pointer from integer without a cast
fp is already a pointer, ...
Hi,
(In C/C++/Linux)
Is there a way to concatenate file A and file B (or actually append one A's content to that of B) only by altering the file system without the overhead of data copying? File A then can be discarded.
Thanks
...
I have been developing an app in VB.NET which requires a control object (for example, a ListViewItem) to be dragged out of the form, and to a user-specified location (for example, on the desktop, or in a folder).
However, The file that is intended to be 'copied', as the 'ListViewItem' represents, does not yet exist. It needs to be downl...
Hi! I'm customizing my OpenCms installation and have created an object that delivers part of my content. The object changes this content once in an hour. Could you please advise me as to how to load this bean at OpenCms startup so that it resides in memory and is able to set up its timer?
...
I am creating a game using the irrlicht c++ 3D graphics engine port to android platform. The graphics engine is written in c++. I need to be able to load meshes and textures etc from c++ code. My current plan is to place all the game asset files in either the res/raw directory or the assets directory then on startup copy these files to t...