I have the following File object pointing to a directory via symbolic link,
File directory = new File("/path/symlink/foo/bar");
String[] files = directory.listFiles();
listFiles() returns null, is this because of the symlink? if yes, how will I go about this if I really want to list the files in bar using the path that contains a syml...
Specifically, I'm trying to create a unit test for a method which requires uses File.separatorChar to build paths on windows and unix. The code must run on both platforms, and yet I get errors with JUnit when I attempt to change this static final field.
Anyone have any idea what's going on?
Field field = java.io.File.class.getDeclaredF...
Hi, I am new to python.
I am trying to extract the text between that has specific text file:
----
data1
data1
data1
extractme
----
data2
data2
data2
----
data3
data3
extractme
----
and then dump it to text file so that
----
data1
data1
data1
extractme
---
data3
data3
extractme
---
Thanks for the help.
...
When I attempt to open a file to write to I get an Ada.IO_Exceptions.Name_Error.
The procedure call is Ada.Text_IO.Open
The file name is "C:\CC_TEST_LOG.TXT". This file does not exist.
This is on Windows XP on an NTFS partition. The user has permissions to create and write to the directory.
The filename is well under the WIN32 max pat...
Hello guys!
I need to search a file for a word and return the whole line and the line number with this word, then edit the line and write back to the file. Maybe the line number isn't necesary to edit a line in a file. I `was reading after seraching with regexp and opening the filechannel of the file, but I can't get the line number. Ma...
Hi,
In my app I 'm first connecting to a web service, which in return sends a url for a file. I use the url to download the file and then display it on the new view.
I get the correct URL but not able to download file from that location. I have another test app which will download file from the same location and it works like a charm.
...
I'm a bit lost here as to why my rake task will not create the desired XML file, however it works fine when I have the method build_xml in an .rb file.
require 'rubygems'
require 'nokogiri'
require 'open-uri'
namespace :xml do
desc "xml build test"
task :xml_build => :environment do
build_xml
end
end
def build_xml
#...
Hi,
I'm writing a MIDlet which needs to write file. I'm using FileConnection from JSR-75 to accomplish this.
The intention is to have this MIDlet runnning on as much devices as possible (all MIDP 2.0 devices with JSR-75 support, ideally).
On several emulators and an HTC Touch Pro2, I can perfectly use the following code to get the roo...
Before calling fflush can I consider fwrite to be = a non-blocking write?
If not, why not and what are my alternatives?
...
I have a large file (hundreds of megs) that consists of filenames, one per line.
I need to loop through the list of filenames, and fork off a process for each filename. I want a maximum of 8 forked processes at a time and I don't want to read the whole filename list into RAM at once.
I'm not even sure where to begin, can anyone help me...
I have two text files that contain columnar data of the variety position-value, sorted by position.
Here is an example of the first file (file A):
100 1
101 1
102 0
103 2
104 1
...
Here is an example of the second file (B):
20 0
21 0
...
100 2
101 1
192 3
193 1
...
Instead of reading one of the two files in...
Hi,
I am writing some code to add file attachments into an application I am building.
I have add & Remove working but I don't know where to start to implement open.
I have an array of bytes (from a table field) and I don't know how to make it automatically open e.g.
If I have an array of bytes which is a PDF, how do I get my app to ...
The following code outputs "Illegal seek":
#include <stdio.h>
#include <errno.h>
#include <string.h>
int main() {
errno = 0;
getchar();
getchar();
getchar();
ftell( stdin );
printf( "%s\n", strerror(errno) );
}
This occurs when I run "cat script | ./a.out" as well as when I just run "./a.out". The problem is...
i gt a struct with 2 integer, i want to store them in a binary file and read it again...
here is my code...
static const char *ADMIN_FILE = "admin.bin";
struct pw {
int a;
int b; };
void main(){
pw* p = new pw();
pw* q = new pw();
std::ofstream fout(ADMIN_FILE, ios_base::out | ios_base::binary | ios_base::trunc);
std::ifst...
I want to display a image using SmallBASIC. For this I've started by searching on the references, then I found a reference for IMAGE, that is like this:
IMAGE #handle, index, x, y [,sx,sy [,w,h]]
Then I found another to open files(OPEN):
OPEN file [FOR {INPUT|OUTPUT|APPEND}] AS #fileN
But I want to know some things:
What image ty...
Having a hard time fixing this or finding any good hints about it.
I'm trying to loop over one file, modify each line slightly, and then loop over a different file. If the line in the second file starts with the line from the first then the following line in the second file should be written to a third file.
with open('ids.txt', 'rU') ...
What is the best way to have an iPhone read from / write to files on a local network?
...
I am trying to read in a text input file that contains a list of filenames (one per line). However, I am running into an issue if the user double-quotes the path (because it has a space in it).
For example, a normal input file might have:
C:\test\test.tiff
C:\test\anothertest.tiff
C:\test\lasttest.tiff
These get read in fine by my cod...
It has always struck me as strange that the C function "fopen" takes a "const char *" as the second argument. I would think it would be easier to both read your code and implement the library's code if there were bit masks defined in stdio.h, like "IO_READ" and such, so you could do things like:
FILE* myFile = fopen("file.txt", IO_READ ...
I have two Java.io.File objects file1 and file2. I want to copy the contents from file1 to file2. Is there an standard way to do this without me having to create a method that reads file1 and write to file2
...