the value of length is seven, word in file is hello, chosen_letter can be any that user guesses. chosen_letter is char ofcourse. my problem is when we type in character 'l' for chosen_letter and it only counts it once. also, the if-loop in the second while loop doesnt work. please help, my assignment is due tommorow :/ void check_letter(char chosen_letter, FILE *ip_file, int length){ int count_let[20], i=0, x=0; length = length-2; while((d1[i] = fgetc(ip_file)) != EOF ){ printf("%c %d\n", d1[i], i); if(d1[i] == chosen_letter){ printf("* %d\n", length); count_let[x] = count_let[x] + i; /* records i in count_let[x] */ x++; } …

Member Avatar
Member Avatar
+0 forum 2

First of all, just registered and this forum looks great! PROBLEM: My program which I wrote in Code::Blocks, has compiled fine and has worked fine, but when I run the outputted file called (BINDED.exe) it shows a very quick console window then closes, I think this is due to the fact I may have corrupted the data. It takes 2 files, reads them both into 2 separate buffers (first one my RAT server) and creates a new .exe. It makes sure it's at the beginning, then puts the stub source in first, [b][u]THEN[/u][/b] puts the RAT server contents, after the …

Member Avatar
Member Avatar
+0 forum 6

Hi i need a little help. i want to read a multi array from a file but code blocks said a lots of error and i dont know whats the problem. can u help me? [ICODE]#include <iostream> #include <cstdlib> #include <math.h> #include <fstream> #include <sstream> using namespace std; int maxn=100; int maxm=100; void beolv(string filename, int &n, int &m, int x[maxn][maxm]) { //fájl megnyitása ifstream fin(filename.c_str(), ios::in); fin >> n; fin >> m; for (int i=0; i<n; i++) { for (int j=0; j<m; j++) { fin >> x[i][j]; } } fin.close(); } int main() { int n; int m; int …

Member Avatar
Member Avatar
+0 forum 2

I am currently working on a project where we must read in a file and then print it back type justified. There must also be a specific number of characters per line based upon user Input with the extra characters being distributed spaces. I am reading in each character from the file storing them individually in an array and then placing the whole word into the linked list(I believe). I am not very experienced with C/C++ so I am not sure I am doing this correctly. I have printed the strings which I believe are being fed into the list …

Member Avatar
Member Avatar
+0 forum 1

Hello, Working on my final project for a Java Class and have become stumped on the final leg of the code. We are supposed to create a program to add a record, remove a record, display a record, and list all records. The records must be written to a file. I have all of it working except the file part. I am able to get the program to write my array, (Which is what I am using to store and manipulate the records during program running), but I am having trouble getting it to read in the contents Back into …

Member Avatar
Member Avatar
+0 forum 6

Hi All, I am facing problem with MapViewOfFile. Microsoft function MapViewOfFile() which reads part of file and returns start address of that content. This function needs some other info which is provided by functions like CreateFile, CreateFileMapping etc. UnMapViewOfFile is to close the view. I am using MapViewOfFile() to read data that of a remote file, and is working fine. There is new content added to the same file on the remote machine. On finding that file is modified, closed the current map and handle etc. The same sequence of steps (functions)called till MapViewOfFile to open the same remote file …

Member Avatar
+0 forum 0

So I want to make a text-based game that has different maps, displayed in ASCII art-style. I've been tinkering with fstream, and I wrote up this code: [CODE]#include <iostream> using namespace std; #include <fstream> int main() { ifstream indata; int i; int j; int k; char grid[9][9]; char letter; indata.open("grid.txt"); indata >> letter; while(!indata.eof() ) { grid[i][j] = letter; indata >> letter; i++; k++; if(k == 10) { k = 0; j++; } } for(int l; l < 10; l++) { cout << endl; for(int m; m < 10; m++) cout << grid[l][m]; } }[/CODE] It should take the contents …

Member Avatar
Member Avatar
+0 forum 4

hey all.. I'm [U]new[/U] to VB.net and i wanted to find out how i could load the names of files(in a specified dir) into a combobox? I knw i should have posted code..but i only have an idea as to what should happen. correct me where i'm wrong. 1. get the number of files in specified dir 2. add names of files as items in combobox (using a loop structure) 3. when an item is selected. display the contents in a textbox my idea in [U]pseudocode[/U]: [INDENT] [I] for counter = 0 to numberOfFiles combobox.add(fileName) next if (combobox.selectedItem = fileName) …

Member Avatar
Member Avatar
+0 forum 2

I have written the following program. It collects inventory information and stores it in a file. I need to write a separate program that will access that file and give me the totals of the information stored in it ie. (quantity,wholesalecost,retailcost). What I'm specifically having trouble with is how to read out the information in file and store it in to a local variable? Any help would be much appreciated! Thanks, -D [CODE]#include <iostream> #include <fstream> #include <cctype> #include <string> using namespace std; const int DESC_SIZE = 31; // Description size // Declaration of InventoryItem structure struct InventoryItem { char …

Member Avatar
Member Avatar
+0 forum 3

Hi, this is a clue game in prolog. [B][U]I'm posting it to thank everyone that takes the time to post and help people, like me.[/U][/B] The program is spanish, cause in from México, but it's a clue game. Features: Write and read *.txt files, and use their content to compare data in the input stream. Generate random variables. "If.. then.." prolog structures Fully functional, I recommend you to use GProlog, I haven't tetsed it in SWI-PROLOG [B]Hope helps somebody and if you like, you're welcome to improve it or modify it ONLY under GPL Licence 3.0 or later. [/B] User …

Member Avatar
+0 forum 0

I wrote a program to analyze a log file for a machine that my company repairs. The program that runs the machine spits output into a text file (.log) and my program will analyze it and return the results of different calculations to the user. The log file idealy looks like this most of the time [CODE] >25 233966 300156 89980 >26 232342 300157 90010 >25 235908 300156 90020 >22 242106 300154 90000[/CODE] This is ideal formatting and USUALLY is the case. Now out of each of those 4 line "paragraphs" only the first and the last lines (eg >22 …

Member Avatar
Member Avatar
+0 forum 5

The End.