473,322 Members | 1,504 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C File IO into array

3
Hi every one

I have an Assignment which due to tomorrow 6:00 p.m GMT;

while (and I am new in programming with C so){

I need a lot of help;
}

the required program is as following:

Develop a C program that has a structure for a list of students that has the array of students and the number of students. The structure for each student consists of ID number, name, GPA, number of courses, and a list of courses. The structure for each course consists of course number, course name, and credit hours. Your program should read the data from a text file then display a menu with the following options:
1. List a table of all students that has ID, GPA, total credit hours
2. List courses a student is taking (given his ID)
3. List students in a course (given course number)



the program that I wrote is as following:
------------------------------------------------------------
-----------------------------------
please?! help me ;-(
Mar 23 '07 #1
8 2300
sicarie
4,677 Expert Mod 4TB
Here are our Posting Guidelines:

Posting Homework or Coursework Questions and Answers
This site is not a place where you can get your homework and course work done for you. Ignoring the questionable morals of getting someone else to do your work towards a formal qualification you will learn a lot more by attempting the problem yourself, then asking for help with the bits that are not working. You will be more likely to get help if you appear to have made an attempt at the problem yourself.

* If it appears that the question has just been pasted directly from a text book or coursework assignment our moderators have been instructed to meet this with a set response. This is a pre-written message asking you to make some attempt at the assignment yourself before asking questions about specific problems and referring you to this FAQ.
* Do NOT post your complete source code. Remember, you found this site, so can your professors and tutors and they are likely to take a dim view if you hand in something that appears to be copied from this site. In most academic institutes the minimum response to copying of assignments is a 0 mark for the assignment in question. If you post your entire code your professor will not know it was your work, you may be penalised for copying from yourself.
* If an expert requests that you provide more of your code then you can PM it to them, however please do not PM them your code unless requested.
* Acceptable questions that students can ask are on functionality and theory or syntax corrections in small posted code snippets.
* Please make sure you have asked an actual question worded in English outside of the text of your assignment that you have posted.
Following those, what specific question did you have about the program you are developing?
Mar 23 '07 #2
hjj
3
Sorry man

here is the question

How can I take the data from text file in to 2d array?!

notes: that the data is a record in each line separated by tab

Sorry again

So, can any one help me now;

regards;
Mar 23 '07 #3
sicarie
4,677 Expert Mod 4TB
Sorry man

here is the question

How can I take the data from text file in to 2d array?!

notes: that the data is a record in each line separated by tab

Sorry again

So, can any one help me now;

regards;
Ok, so you are having difficulty reading input in (worry about the 2d array later), google filestreams in c++, that should get you started, and should also show how to do arrays.

I personally like cplusplus.com, I would recommend their file io tutorial.
Mar 23 '07 #4
hjj
3
thanx I will try that

please notes that I should use pure C

I appreciate your fast response

Best regards;
Mar 23 '07 #5
sicarie
4,677 Expert Mod 4TB
thanx I will try that

please notes that I should use pure C

I appreciate your fast response

Best regards;
Then the google search with 'c programming' instead of c++ will do, but filehandles are similar in C and C++.

That being said (the ability to search and figure out the answer to a question on your own is almost as valueable as being able to answer the question itself - at least if you're considering a career in IT), this looks like a good tutorial on C file IO.

(I've also changed the title of this thread to better represent the question you are asking - hopefully that will bring more input to your questions.)
Mar 23 '07 #6
DeMan
1,806 1GB
(In my experience, google ignores ++ anyway unless you use qutoes) - that's m,y 2 cents
Mar 23 '07 #7
sicarie
4,677 Expert Mod 4TB
(In my experience, google ignores ++ anyway unless you use qutoes) - that's m,y 2 cents
Really? It's always picked it up when I have done them... (I think, at least....)

/me goes to check

Yeah, it shows up. Then again, I never do any sort of "sentence" searches - I user google searches like directories - c++ to specify the language, then maybe the topic of the language (like file io), then a specific function or library... I dont' know if that makes a difference or not.
Mar 23 '07 #8
DeMan
1,806 1GB
maybe not then....
Mar 24 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Jens Mittag | last post by:
Hi! In my code, I have an array of a structure, which I want to save to a binary file. When the array is just created, everything works fine, but when I change contents of the array, saving...
6
by: Betty Hickman | last post by:
I'm having trouble writing a 2D array to a binary file. Here's what I have: FILE *outfile; short **clump_class; clump_class = malloc(nrows * sizeof(short *)); for (i=0; i<nrows; ++i)...
9
by: steph_de_marseille | last post by:
I would like to write a x array in a file. If the array has a small numbers of columns I know I can use a loop like: int i,j; double array; FILE *file1; file1=fopen("data.dat","w");...
2
by: melanieab | last post by:
Hi, I'm trying to store all of my data into one file (there're about 140 things to keep track of). I have no problem reading a specific string from the array file, but I wasn't sure how to...
2
by: kelly | last post by:
Hi, I don't have a code to show you, what I need are references or algorithms so that I'm in a right track. By the way, thanks for introducing me the array or arrays. Now I can continue my...
29
by: yourmycaffiene | last post by:
Okay, this if my first post so go easy on me plus I've only been using C for a couple of weeks. I'm working on a program currently that requires me to read data from a .dat file into a 2d array and...
9
by: Adi | last post by:
Hello eveyone, I wanna ask a very simple question here (as it was quite disturbing me for a long time.) My problem is to read a file line by line. I've tried following implementations but still...
7
by: theballz | last post by:
Hi, I am learning c programming and come across a problem i cant seem to solve. I have a file which i wish to parse and put certain lines (which do not contain a hash character) into an array...
19
by: Lee Crabtree | last post by:
Is there a class in the framework that allows me read text from a file in an unbuffered manner? That is, I'd like to be able to read lines in the same manner as StreamReader.ReadLine(), but I also...
13
by: rohit | last post by:
Hi All, I am new to C language.I want to read integers from a text file and want to do some operation in the main program.To be more specific I need to multiply each of these integers with another...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.