51 Topics

Member Avatar for
Member Avatar for dimitrilc

## Introduction ## If you are a Java developer coming to Kotlin, you might have wondered how to use a language construct that is similar to the try-with-resource statement in Java to automatically close Autocloseable/Closeable resources for you. Luckily, Kotlin provides the inline extension function `use()` that provides similar functionality …

2
318
Member Avatar for dimitrilc

## Introduction ## The `java.nio.file.Files` class includes many convenient methods to read file attributes, but sometimes these convenient methods just are not enough to meet our needs. In this tutorial, we will go over 5 ways to use the `Files` class to read file attributes so you can choose the …

3
202
Member Avatar for dimitrilc

## Introduction ## In this tutorial, we will focus on how to manage IO permissions to read, write, and delete local files using the `SecurityManager` class. ## Goals ## At the end of this tutorial, you would have learned: 1. What policy files are and how to use them. 2. …

2
252
Member Avatar for Matthew N.

Hello, I'm trying to write data to an INI file, I've got some code to read it: [http://pastebin.com/Jpwf8XJM](http://pastebin.com/Jpwf8XJM). I've tried to modify this code to get it to be able to write to INI files, but I haven't had much success. I know there are DLL's designed for this, but …

Member Avatar for jehernandez757
0
3K
Member Avatar for Mr.M

Hi Dw. I'm using this code available from [here](http://www.coderslexicon.com/using-hashes-to-check-if-a-file-changed-in-vb-net/) and I have changed it from keeping the hashs on a variable(array) to writing it on a file. Now what I want to do is to read this file. Basically I'm scanning through all my drive file and for each file …

Member Avatar for Mr.M
0
514
Member Avatar for Mr.M

Hi Dw. I'm trying to read a text file. This text file has a multiply lines and what I want is that I want to separate each line or should I say I want to split each line (chop it) so that I will be able to assign these fields …

Member Avatar for Mr.M
0
598
Member Avatar for vegaseat

Sometimes it's easier to pick an image from the internet to display in your Python Tkinter GUI toolit program.

Member Avatar for vegaseat
1
5K
Member Avatar for entropicII

I have recently been writing some code that asks the user questions about german. br = new BufferedReader(new FileReader("C:\\Users\\Patrick\\Desktop\\Java Workspace\\germanTool\\src\\germanTool\\lesson1.txt")); String[] engList = null; String[] deuList = null; int i = 0; while (br.readLine() != null){ lineCount++; line = br.readLine(); engList[i] = line.split("\t")[0]; deuList[i] = line.split("\t")[1]; } Using this code …

Member Avatar for entropicII
0
217
Member Avatar for TrustyTony

Here is simple text file example for beginners, using try..except for reading old content as it may not yet exist.

Member Avatar for TrustyTony
1
465
Member Avatar for CreatorZeus

I'm having a simple i/o with file problem. I have the name coming from a string but it just wont open at all. Incoming code: string notename[] = {"NULL","empty"}; ifstream readnote; readnote.open(notename[x].c_str(),ios::in|ios::out); if(!readnote) { cout << "Read Error"; } its prolly something small but i keep getting the error, can …

Member Avatar for CreatorZeus
0
281
Member Avatar for castajiz_2

int main(int argc, char** argv) { FILE *f; char string[100]; int counter=0; f=fopen("New Text Document.txt","r"); if (f==NULL) { printf("error"); } while(!feof(f)) { fscanf(f,"%c",&string); } fclose(f); for(int i=0;i<100;i++) { if (string[i]=='a') /*doesnt work, why?*/ { counter++; } } printf("\n the number of vowels a is : %d",counter); getch(); return 0; } …

Member Avatar for deceptikon
0
143
Member Avatar for Stpdoug

Hey guys i am having a problem with displaying a single record out of a text file the code is not reaching the "if" function in the while loop of the "getRecord" Function please help. Everything else is working import java.io.*; import java.util.Scanner; import java.util.InputMismatchException; public class FileTest { //Globals …

Member Avatar for Stpdoug
0
325
Member Avatar for vegaseat

The code sample shows how to get an image from the internet and show it in a Tkinter label widget.

Member Avatar for Nils_1
4
2K
Member Avatar for Labdabeta

Hello. I am wondering how EOFs are indicated to either the cstdio functions or the fstream functions. Mainly I am wondering how it differentiates it from data. For example, if EOF is a 2-byte code wouldn't this break the system by inserting a 'false' eof flag: for (int i=0; i<256; …

Member Avatar for Labdabeta
0
177
Member Avatar for Jorox03

I am trying to write some code to regex search against wide strings. The problem I am having is that the regex operations ( `regex_search` in particular ) does not take in wide arguements. Here is the snippet I am having trouble with: Function Header: void scan_filesystem( wpath const& f, …

Member Avatar for Jorox03
0
6K
Member Avatar for jesskavidja

I have a bit of a baffling problem! I'm writing a tag matcher in XML and whenever I run the below procedure, I get a garbage value after the name of every tag **except for the first one**. When I add the array text to the parameters list, the garbage …

Member Avatar for rubberman
0
294
Member Avatar for Jorox03

I am trying to add a comma to the end of each line ('\n') of a text file til the end of the file is reached. I am opening the file in append mode but am unsure as to how to go about identifying when the end of line is …

Member Avatar for Jorox03
0
3K
Member Avatar for nomorelogic

i would like to have the ability to tell the player they cannot go that way if the exit does not exist the rooms are in a text file that is read in, i know i should use a if function but dont know where to put it, any help …

Member Avatar for spuriousgeek
0
269
Member Avatar for jspence29

What I am trying to do is make a program that reads a txt file and converts the number into a double array. import java.io.*; import java.util.ArrayList; import java.util.Arrays; import java.util.List; public class rocket { public static void main(String[] args) throws IOException, FileNotFoundException { System.out.println(readLines("/Users/Jeremy/Documents/workspace/altitude.txt")); } public static Double[] readLines(String …

Member Avatar for jspence29
0
380
Member Avatar for yup790

In the main class the user enters text trying to find the file in the same directory as the source file. The string gets passed into the constructer and a file object is made but the file isn't found. The print statements are just to find out what is happening. …

Member Avatar for yup790
0
385
Member Avatar for fheppell

I need to build a gift voucher section of my python cash register software Here's the code I have so far elif payment == '3': print "Scan or enter gift card" cardno = raw_input('Card Number: ') try: with open(cardno, '.txt') as f: pass value = f.readline() except IOError as e: …

Member Avatar for Lucaci Andrew
0
155
Member Avatar for LdaXy

i'm writing a text based game that creates a world based on the data inside of the specified file. however, the code i have won't let me use the function DataInputStream.ReadFully(byte[]b) Code: package textgame; import java.io.DataInputStream; import java.io.FileInputStream; import java.io.IOException; import java.util.Stack; public class world { Stack<String> LevelData = new …

Member Avatar for stultuske
0
1K
Member Avatar for foodstamps

I'm trying to process a list contained within a separate text file. I am able to read the file, and generate an output containing the contents of the file, but the output generated is the unprocessed version, identical to the input. I do not encounter this problem when the list …

Member Avatar for foodstamps
0
308
Member Avatar for algrandjean1

Hello, I am having some difficulties getting my program to write the contents of an object to a file. First off, I am not sure if I should be writing the contents of the the object (e1, e2, e3) to the file or if I should be writing the contents …

Member Avatar for aradicev
0
279
Member Avatar for iamcreasy

Hi, I used to solve ACM problems, but I used old scanf & printf for input and output.But now i want to use C++ style IO. So, i picked a simple problem, and tried to convert its old style IO to new style IO. The problem : [URL="http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=996"]http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=996[/URL] (in summery, …

Member Avatar for iamcreasy
0
259
Member Avatar for rahul.ch

import java.io.*; public class Mac extends Laptop { public static void main(String r[]) { new Mac().crunch(); } //insert code here } class Laptop { void crunch() throws IOException { } } The question is simple. Insert a code that will make the program compile. Answers are: `void crunch()` or `void …

Member Avatar for NormR1
0
212
Member Avatar for VengefulToast

Will someone please tell me why I keep getting my custom file not found exception? The file is spelled correctly and is in the same directory of my java file. I am programming on Eclipse on Mac OS X. Here is my source: // Dillon Sheffield // Lab 10a // …

Member Avatar for VengefulToast
0
269
Member Avatar for codechrysalis

ok so im working on a application that displays the charges along with displaying the zip code. I seem to have a IO exception error for the console.clear() line. Is there anything else I need in order to display the charges along with zip code? Im thinking a nested if …

Member Avatar for skatamatic
0
165
Member Avatar for gdubz

Im trying to take input data from a user as a string of number or letters and store each char on a different array, whats the proper syntax fro this?

Member Avatar for Zvjezdan23
0
224
Member Avatar for boris90

Hi, this is my first post here, and I really need some help with my homework. I'm a newbie to Java programming, and I have this assignment: [I]Write an application which reads data from a file about certain items (one row - one item, stored are the integer valued code, …

Member Avatar for DavidKroukamp
0
275

The End.