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 I hash it and its hash code I save it on a text file on its own line and I have a special separator then a file name. So what I want to do is to read through the text file and get the names and on each file I …

Member Avatar
Member Avatar
+0 forum 2

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 to variables using the array. What I first did is to get the lines then for each line I need to break it. The split I'm using the "*" as a separator. Each line will produce/has 13 fields so I want to get these as a variable. Here is just …

Member Avatar
Member Avatar
+0 forum 12

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

Member Avatar
Member Avatar
+1 forum 1

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 I have been trying to read a file. On each line of the file there is a translation of an english word into german seperated by a tab. I want to write all of the english words into one array and all of the german ones into another array with …

Member Avatar
Member Avatar
+0 forum 9

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

Member Avatar
Member Avatar
+1 forum 6

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 u see it?

Member Avatar
Member Avatar
+0 forum 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; } the counter does not increment, i m not sure why.

Member Avatar
Member Avatar
+0 forum 4

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 public static Scanner input = new Scanner(System.in); public static String name = ""; public static String address =""; public static int age = 0; public static int id =0; //---------------------------------------------------------------------------- public static void main(String[] args) throws IOException { // TODO code application logic here String choice = " "; System.out.println("------Sample …

Member Avatar
Member Avatar
+0 forum 10

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

Member Avatar
Member Avatar
+4 forum 2

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; ++i) for (int ii=0; ii<256; ++ii) fout<<(unsigned char)i<<(unsigned char)ii; And the same argument would obviously extend to any length of the eof flag. I am wondering if there actually is a way to (accidentally or not) create a false EOF flag. I mainly wonder because I am trying to define …

Member Avatar
Member Avatar
+0 forum 4

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, wregex const& reg, unsigned i = 0 ) Snippet: while ( !fileStream.eof() ) { vector<wstring> tokens; wstring line; getline( fileStream, line ); wistringstream iss( line ); copy( istream_iterator<wstring, wchar_t, char_traits<wchar_t>>(iss), istream_iterator<wstring, wchar_t, char_traits<wchar_t>>(), back_inserter< vector<wstring> >(tokens)); auto it = tokens.cbegin(); auto end = tokens.cend(); wsmatch m; while ( regex_search( it, …

Member Avatar
Member Avatar
+0 forum 2

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 value goes away (I had it there during initial debugging) even though it isn't actually referenced at any point in the procedure. Another thing, is that while reading a tag, it doesn't seem to want to recognize spaces. For example, <img src="img.png"/> reads as imgsrc="imgpng" instead of img, but only …

Member Avatar
Member Avatar
+0 forum 1

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 reached and how to add the comma (perhaps replace the newline char with the comma). Any suggestions?

Member Avatar
Member Avatar
+0 forum 3

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 would be appreciated, if you need more or all of the code just say void RoomsGame() { char choice; int playerPos = 0; initDungeon(); cout << "Choice : "; cin >> choice; choice = tolower(choice); while (choice != 'q') { if ((choice == 'n') && (testRooms[playerPos].getNorth() != -1)) { playerPos …

Member Avatar
Member Avatar
+0 forum 5

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 filename) throws IOException { FileReader fileReader = new FileReader(filename); BufferedReader bufferedReader = new BufferedReader(fileReader); List<Double> lines = new ArrayList<Double>(); String line = null; while ((line = bufferedReader.readLine()) != null) { lines.add(Double.parseDouble(line)); } bufferedReader.close(); return lines.toArray(new Double[lines.size()]); } } This is my code, but when I run it I get [Ljava.lang.Double;@35960f05 …

Member Avatar
Member Avatar
+0 forum 3

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. The commented out code makes no difference either way. Generateresponse(String humanphrase){ //humanphrase += ".txt"; System.out.println("in new class"); //checks if file exists File f = new File(humanphrase); if(f.isFile()){ System.out.println("exists");

Member Avatar
Member Avatar
+0 forum 12

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: print 'Invalid number' Just to clarify how my code works, when a gift card is created a text file called [card number].txt is created. I need to read the first line of this file, which contains the amount left on the gift card (eg 15.30). I need to check that …

Member Avatar
Member Avatar
+0 forum 3

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 Stack<String>(); int location; int EndLocation; public world(Stack<String> s, int l, int e) { s = this.LevelData; l = this.location; e = this.EndLocation; } } class world_render { public world RenderWorld(String file) { Stack<String> data = new Stack<String>(); int location = 0; FileInputStream LevelIn = null; try { LevelIn = new …

Member Avatar
Member Avatar
+0 forum 9

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 is contained within the module that I'm working with - the process runs successfully. Any ideas why using the input file is causing problems? This runs successfully (please note - for both runs, "correct" is a function within the same module): import sys sys.stdout = open('out.txt','w') def spelltest(): for i …

Member Avatar
Member Avatar
+0 forum 3

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 of the map (x1, x2, x3). How would I go about doing this? This is what I get when in the output file whenever I run the program: This is line one d¯»ò@»xH@,¯»ò@Ending line #include <iostream> #include <string> #include <map> #include <set> #include <fstream> #include <cstdlib> using namespace std; class …

Member Avatar
Member Avatar
+0 forum 1

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, as input two numbers will be given, and you have to print the difference of that two numbers. :P ) Old Style: Online Judge Accepts this code. [CODE]#include<stdio.h> int main() { long double a,b,d; while(scanf("%Lf %Lf", &a,&b) == 2){ if (a > b) d = a - b; else d …

Member Avatar
Member Avatar
+0 forum 11

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 crunch() throws RuntimeException {}` Then a note was given for an incorrect option that `void crunch() throws FileNotFoundException {}` would be correct if crunch() invocation on line 5 was either handled or declared. Doubt: I understood the correct options. I did not understand how the invocation has to be handled …

Member Avatar
Member Avatar
+0 forum 1

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 // April 12, 2012 import javax.swing.*; // Needed for Swing classes import java.util.ArrayList; // Needed for the Array List Object. import java.awt.*; // Needed for Layout manager and Color import java.awt.event.*; // Needed for ActionListener Interface import java.io.File; import java.io.FileNotFoundException; import java.util.Scanner; public class ShoppingCartSystem extends JFrame { private JPanel leftPanel; …

Member Avatar
Member Avatar
+0 forum 2

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 I would like to have my application so it can be distributed as a single EXE. Also, I know there is My.Settings, but I cannot use this, as this INI file is used by another application, that I have not developed. So, I was wondering if anyone could help me …

Member Avatar
Member Avatar
+0 forum 2

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 statement possibly? Thanks a lot everyone [CODE] using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PackageDelivery { class Program { static void Main(string[] args) { int zipThatIamLookingFor; string inValue; double charges; bool moreData = true; int[] zipCode = new int[10] { 32309, 32398, 32345, 32211, 32215, 32312, 32317, 32308, …

Member Avatar
Member Avatar
+0 forum 6

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
Member Avatar
+0 forum 4

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, amount and name of an item) into one of Java's collections (e.g. Vector, ArrayList or LinkedList). After that, user, from standard input, enters item's code (e.g. 253201) and amount he wants, and program updates the amount of that item in collection, and it displays the message to the user with …

Member Avatar
Member Avatar
+0 forum 1

Hi, I've been searching around these forums for quite a while now, and can't seem to either understand or find what I'm looking for. ^ As you can probably tell, I'm a real Novice to VB! I have a text file, that my program is always adding to it, it's format is like so: Line 1: UserName (For User 1) Line 2: FilePath (For User 1) Line 3: UserName (For User 2) Line 4: FilePath (for User 2) For Example: Line 1: Tobyjug2222 Line 2: J:\Program name\bin\Debug\Accounts\Tobyjug2222 Line 3: Toby Line 4: J:\Program name\bin\Debug\Accounts\Toby ... ... My program automatically writes …

Member Avatar
Member Avatar
+0 forum 8

Hello Friends, I have developed a windows application using C#, its installed on [code]C:/program files/application folder/application.exe[/code] I have not used Data base so i have used files (CSV/TXT) for storing data, there is many types of files generated by application and some application setting variables are also stored in a file named [code]C:/program files/application folder/Application Settings folder/applicationSettings.data[/code] (encrypted Text file) application used these settings to read paths other files and some other settings, this application also have the feature to print document/images using [code] PrintDocument printDocumentObj= new PrintDocument(); pd.PrintPage += new PrintPageEventHandler(PrintPageEventHandlerFunc); ..... [/code] application prints files successfully but if …

Member Avatar
Member Avatar
+0 forum 3

the problem is if you increase buff size and also change the buff size in a3_fgets_2 function call to more than 15, the program will run in an infinite loop, Can anybody tell me why? Thanks [CODE]#include<unistd.h> #include<string.h> char * a3_fgets ( char * str, int num, int fd ); char * a3_fgets_2 ( char * str, int num, int fd ); int main(int argc, char **argv){ char buff[15]; /* while(fgets(buff, 256, stdin)) printf("%s", buff); puts("\n================================"); */ /* while(a3_fgets(buff, 5, 0) != NULL) printf("%s", buff); puts("\n================================"); */ while(a3_fgets_2(buff, 15, 0) != NULL){ write(1, buff, strlen(buff)); } puts("\n================================"); return 0; } …

Member Avatar
Member Avatar
+0 forum 4

The End.