C :: Add More Student Information To The Specific Txt File?

Mar 12, 2013

I'm trying to add more student information to the specific txt file. I did struct my student information and separated it with an array with max size of 200.

The inside of my current file looks like

Toshi
Aka
Nonal
Donald

The first one represent student[0] and next one is student[1] and so on till student[199]. Right now, only 4 space is occupied, which means the array has information till student[3] but not from student[4] (I guess it has null condition).

What I want to do is, I want to add a new student information to student[4] and till student[199] once at each time.

So, my prompt will look like
Would like to add a new student? Y/N
(if yes goes to below statement and exit if NO)
Hi. Please enter the information of new student. ___________
Student added. Please press any key to continue.

If the key is pressed, it goes back to my initial prompt and continues till I press N.

I sure I'm not using for loop to do this thing, because I'm adding student name one by one.

However, the array is already occupied by other student name till student[3] so, I want to add a new student information to student[4] (I don't want to overwrite the current information). And if student[4] is occupied, then [5] and so on.

View 7 Replies


ADVERTISEMENT

C Sharp :: Get Specific Folder Size Information From NAS / NTFS Location After Mapping

Sep 26, 2012

How to measure a NAS (NTFS) free space/total space and used space? Few more details: I have the needed code to map the NAS location (serverNameshared_folderfoldersub_folder) into the local server where I am running my applciation but I can only get the needed statistics above for the whole NAS, I need to know the statistics for a specified folder on the NAS, how can I do that?

View 1 Replies View Related

C :: Student Record System / File Handling

Feb 25, 2013

Code:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
}

[code]....

I dont know how to modify the previous record that i have done in the Add Student function. i searched from different sites and got this code for modifying a record in a text file. But, i cant figure it out why its not working.

View 2 Replies View Related

C++ :: Student Registration System - File Updating

Feb 14, 2012

I have been creating this program for a student registration system. For the file handling So far I can write in to a file , view all records, and search a single record. now i got the problem with updating details . my coding is as bellow ..

void file_update() {
int r;
struct student stu;
fstream stu_file;
cout <<"========Update Record======"<< endl;
stu_file.open("student.txt", ios::app );

[Code] ....

My problem is it won't update the record. it just adding a new record.

View 9 Replies View Related

C++ :: How To Make Specific Character Show Up Specific Amount Of Times

Mar 5, 2013

How do I make a specific character show up a specific amount of times?

Like I am generating a random number then I need to make "|" show up that many times on the screen.

View 1 Replies View Related

C :: Reading From File Certain Information

Jul 31, 2013

//---------------------------------------------------------------------------------------
//FUNCTION: vDelEditStudents()
//---------------------------------------------------------------------------------------

void vDelEditStudents() {
FILE *file = fopen("C:UserForCtxtgiro.txt", "rb");
Student StdStruct;
fseek(file, -sizeof(StdStruct) , SEEK_END);
fread(&StdStruct, sizeof(StdStruct), 1, file);

[Code] ....

The problem is that ... Even though it is reading from a a file, it is not reading a one struct. In this piece of code I'm trying to read the last struct, which should be k... The struct itself is here

Code:

typedef struct {
char StudentName[30];
uint16 StdAge;
uint16 StdNumb;

}Student;

And here is my input and output:

INPUT:
4
1 g 1 2
1 h 3 4
1 j 5 6
1 k 7 8

View 4 Replies View Related

C++ :: Reading Information Out Of File?

Apr 12, 2014

I need to read some infos out of a .txt-file.

The problem is that i dont know how to do because 'getline' won't work i think.

the file looks like this:

*******************
Inventory of MyInventory
*******************
Some info
More info
-------------------
000 Toys 6.25
a short description
126/44 Cards 2.25
some text
*******************
Inventory of MyInventory2
*******************
Some info
More info
-------------------
000 Toys 6.25
a short description
126/44 Cards 2.25
some text

So what I need to know:

- the name of the Inventory (MyInventory, MyInventory2...)

- the numbers in each row (000,126/44...)

- the name what it is (Toys,Cards...)

- the price (6.25,2.25...)

- and the description(problem here is, that there are not the same amount of words for each description)

I tried it with 'getline' but this is not working because the lines are so different each time.

View 2 Replies View Related

C/C++ :: Receiving Information From A File?

Nov 13, 2014

I want to receive an information from a file. For instance, you created a file name "sample.txt" via fstream and stored a bunch of people's name, address, phone number in that "sample.txt".

Now, I want to see what's stored in this file. Suppose, I wanted some particular guys address, phone number by just typing is his/her name.

How to relate the name with address and phone number of particular people? I just started the file creating so I wanted to know about it.

#include<iostream>
#include<conio.h>
#include<fstream>
#include<string>
using namespace std;
int main() {
ofstream outputData;

[code].....

View 12 Replies View Related

C++ :: TXT File - How To Get Each Specific Value And Add Them All Together

Oct 10, 2013

so I wrote this code in class today and I'm almost done but I need to come up with some sort of equation to add up all the total values. The problem is I am reading data off a txt file so it's all being read as one thing. I don't know how to get each specific value and add them all together. This is my code so far.

#include <iostream>
#include <iomanip>
#include <string>
#include <fstream>
using namespace std;

[Code] .....

here's what's inside the input file

Chisel 50 9.99
Hammer 30 15.99
Nails 2000 0.99
Bolts 200 2.99
Nuts 300 1.99
Soap 55 1.89

I end up multiplying the amount by the price to get the total value as shown in the code above. Now I just don't know how to add the total value of each item to get the total overall value. Also I haven't used invTotal because I want that to be the overall total.

View 1 Replies View Related

C :: Saving Information From A File To Struct

Jan 12, 2014

I want to take the informaition from this file and save it into a struct the file conteins name age year (in char) and a grade it is somthing like this

file
Nikos Tolis 19 A 8
Iwanna Nikolaou 20 B 9
Kwstas Doukas 20 Β 6
Georgios Pappas 19 A 7
Iwannis Lekatis 20 Β 7
Nikos Ntoumas 19 A 5
Maria Oikonomou 20 B 6
Kwstas Argyrou 19 A 10
Irw Ntouma 20 B 8
Leuteris Doukas 19 A 6

I want to read till i found the '32' the space in ascii here is my code so far

Code:
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
struct students
{
char *name;
int age;

[Code] ....

View 2 Replies View Related

C++ :: Parse A Text File That Contains Information

Jul 31, 2014

I am trying to parse a text file that contains information and i cant seem to get started. For example, the text file looks like this:

idx=929392, pl= 12, name= someperson
age=19
state=ma
status=n/a

idx=929393, pl= 12, name= someperson2
age=20
state=ma
status=n/a

idx=929394, pl= 12, name= someperson3
age=21
state=ma
status=n/a

I want to parse the name and age into another text file like this format:

someperson 19
someperson 20
someperson 21

possibly include other attributes next to the age like idx?

View 3 Replies View Related

C/C++ :: Extracting Information From Data File?

Apr 20, 2015

Create a simple data file like the example shown below containing the 4 dates below plus 10 or more additional dates. The file should include 1 date per line and each date should have the form MonthNumber-DayOfTheMonth-Last2DigitsOfTheYear with no extra spaces. All dates should be in this century. No error checking for invalid dates is necessary.

My Output displays like

February -19,1991

How do I get my program to ignore the dash between the dates?

#include <fstream>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(){
const int M = 13;

[code]....

View 1 Replies View Related

C/C++ :: Getting Specific Info From A TXT File?

Oct 10, 2014

I'm trying to open a text file with the name "text.txt", for the purpose of only displaying in the console an specific part of the text file. For example, if I got "This is a test [TEXT] This is the message that should display [/TEXT] this is the end of the file", I want only "This is the message that should display" to be the output, the thing is that I can't imagine anyway of doing that. what I should do?

View 5 Replies View Related

C :: File Process - Delete Or Update Information

May 18, 2013

i have written a student information storing program. it has add,delete,list,and update menu (in program i have written update == uptade,i know : P )

my question is i cant delete or update the information. where is my failure ?

Code:

#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<conio.h>
#define max 3
struct og {
char id[12];

[Code]...

View 2 Replies View Related

C++ :: Program Won't Output Any Information To Text File

May 6, 2013

my program wont output any information to the text file that I have specified it just creates it but it leaves it blank

#include <iostream>
#include<string>
#include<iomanip>
#include <fstream>
using namespace std;
class Carloan

[code]....

View 2 Replies View Related

C++ :: Store Information From A File In Linked List

Aug 28, 2014

I'm trying to open a file (contains member information) and store the information in an object, which is then inserted into a linked list. However, the current code just leaves a blank command window hanging with nothing happening.

main.cpp - [URL] ....
MemberProf.h - [URL] ....
MemberProf.cpp - [URL] ....
LinkedList.h -[URL] ....

View 7 Replies View Related

C++ :: Retrieve Information From Two Files And Put Them In A Single File

Nov 23, 2013

I created a simple program that writes some text to two different text files. how to create a program that would retrieve the information from those two files, and put them in a single file, first the content of input1 and then the content of input2. how to do this. Here is the program that I created that creates the two files.

#include <iostream>
#include <fstream>
#include <string>
int main() {
using namespace std;
string input1;
ofstream fout("input1.txt");

[Code]...

View 3 Replies View Related

C++ :: How To Read Information From Text File To Array

Apr 4, 2014

Perhaps my original wording on this was confusing so I will ask a different way.

if I have a text file called

data.txt

and it has the following in it.

12345
67890
12345
67890

how would i read this information into an array called

int data[4][5]

This is in C.

View 10 Replies View Related

C++ :: How To Share Information In Multi File Project

Dec 9, 2013

this last few days I've been coding this one particular file

Hero.cpp

namespace Hero {
namespace {
// all data here
}
}

then the code grew a bit to about 700 line

Then now I want to implement hero skill system It needs the access to data inside the unnamed namespace where I put just about everything.. but it's unnamed namespace, it's only valid within one file and I should hide all that data from Hero interface in Hero.h How should I do this ?

View 12 Replies View Related

C++ :: Reading Tab-delimited File - Information Of A Graph

Jan 10, 2013

I have a network data file that looks like this:

2476
112
213
321
426
531
634
7312
843
945
...
...
...

The first row has two values - number of nodes (24) and number of links (76). Then it has all the link details (76 rows of data). I want to read this data. I have written out the following function:

First the structure definitions:

typedef struct {
int arcno;
int tail;
int head;
} arc_data;
typedef struct {
int forwardStarPoint;
int reverseStarPoint;

[Code] .....

The code is able to read the first line of data (i.e. it displays the numNodes and numArcs as 24 and 76). But then I get a lot of errors like this one

`Access violation writing location 0xCCCCCCD8`.

The program then crashes.

View 3 Replies View Related

C :: Updating Specific Data In The File

Mar 17, 2013

Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define MAX 200

[Code] ....

Inside of my studentinfo.txt file

Code:
Jnh Has 2353325 23 56 72 34 67 22 46 42 5 23 56 23
Daniel Laurent 6744590 10 20 30 40 50 60 70 80 90 100 40 50

This code is working totally fine. Right now, I'm trying to update a specific data from the student info. Let's say I'm trying to update my student number of Daniel. So, in this case, I want to replace 6744590 to some other student number. I think I have to use fseek() or rewind() and use fputs() but, I don't know how I should decide where to look.

View 8 Replies View Related

C++ :: How To Read A Specific Word From A File

Aug 12, 2014

How would one go about doing this? I am very fond with Windows I/O, but not so much with this subject. I am decent with fstream, probably not as skilled at it as I should be, but I assume <fstream> would be a better choice, since it isn't locked to Windows.

Anyway, say I have a .txt file like this:

Bill is a cow.
Bill likes meat.
Bob is a pig.
Bob and Bill are friends.

And I want to count the number of times "Bill" is written. How would I do that?

View 5 Replies View Related

C/C++ :: How To Read Specific Column From A File

Nov 21, 2013

I have a .txt file which contains 121 lines,now I want to read the no 20 columns from that file. How to read it. I have tried the following code.

my c.txt file look like following :

A B C D E.....AAA
 
#include<stdio.h>
#include "conio.h"
#include "string.h"    
int main() {
    FILE *fp;  
    char a2[500];

[Code] ....

View 1 Replies View Related

C :: Read Data File And Emit Various Bits Of Information

Mar 31, 2014

For my intro to c programming class, our homework requires us to read a data file and emit various bits of information. the data file looks like this

#Domain: the URL
#Alexa: some kind ranking, small numbers are better
#Rank: another sort of ranking, big numbers are better

#Domain Alexa Rank Site Name
#------------ ----- ------- ---------
amazon.com 13 1177136 Amazon.com
google.com 1 4533883 Google
youtube.com 3 3637788 YouTube

[Code] ....

I've started and am able to get the correct number of lines, and the alexa number, but I keep getting some errors and am just unsure where to correct my code. This is what it looks like;

Code:
// Lexi Anderson
//CS 156
#include <stdio.h>
int main() {

[Code] .....

and once compiled, I get errors.

View 7 Replies View Related

C :: Take Personality Information From User And Store It In Text File

May 17, 2014

I was trying to make a program in C that could take Personality Information from the user and store it in a text file. Then, when asked, could compare the results to other entries in the so called "data-base" and tell which is the best match. I tried a whole lot but couldn't think of a proper way.

(Stings and File IO are not my strong points)

I am using Code Blocks 10.05 and the standard GCC compiler.

View 6 Replies View Related

C++ :: Read From A File And Store Information In Separate Variables?

Dec 8, 2014

So I have to read from a file, and store the information in separate variables. My problem is that for some of the information I need multiple words, and for others I don't, so I cant simply store 1 word into a variable and store the next in another in so on. To demonstrate what I mean let me give an example.

Dog Cat Blue Bird Snake White Horse

I am able to store "Dog","Cat","Blue","Bird"...etc in variables but I don't know how to make it so I can store "Dog" in one variable, "Cat" in a second variable. and "Blue Bird" in a third variable. "Snake" would be the 4th and "White Horse" would be the fifth. How can I read a file and manipulate the pointer to grab what I need?

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved