473,378 Members | 1,429 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,378 software developers and data experts.

Employee Program problem only part

I am doing a likned list program in C.
I am not really good at it and just started. But I am stuck how to pass structure in the function correctly.

this is the driver file
Expand|Select|Wrap|Line Numbers
  1. #ifndef DRIVER_C
  2. #define DRIVER_C
  3. #include "constants.c"
  4. int main(void)
  5. {
  6.   struct employee *startPtr = NULL;
  7.  
  8.   FILE *fileptr= fopen("hw3Employees.dat","r");
  9.   employee only;
  10.  
  11.   getvalues( only, *fileptr);
  12.  
  13.   //insert(&startPtr, fname[],lname[],middle[],id,title[],balance);
  14.     return 0;
  15. }
  16. //void insert(struct employee **sPtr, char fname[],char lname[],char middle[],int id,char title[], int balance)
  17. //{
  18. //return;
  19. //}
  20.  
  21. void getvalues(struct employee *only,FILE ** fileptr)
  22. {
  23.  
  24.     fscanf(*fileptr,"%s%s%s%d%s%d%x",only.fname,
  25.                 only.lname,
  26.                 only.mname,
  27.                 &(only.id),
  28.                 only.title,
  29.             &(only.Balance);
  30.         printf("%s %s   %s    %d    %s    %d  %x\n",only.fname,
  31.             only.lname,
  32.             only.mname,
  33.             only.id,
  34.             only.title,
  35.         only.Balance);
  36. return;
  37.  
  38. }
  39. #endif
  40.  
and the constants file
Expand|Select|Wrap|Line Numbers
  1. #ifndef CONSTANTS_C
  2. #define CONSTANTS_C
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #define ARRAY_SIZE 5
  6. #define ZEROI 0
  7. #define ZEROD 0.00
  8. #define NAME_LEN 30
  9.  
  10. typedef struct {
  11.         char fname[NAME_LEN];  //first name
  12.         char lname[NAME_LEN];  //last name
  13.         char mname[2];
  14.         int id;
  15.         char title[NAME_LEN];
  16.         int Balance;
  17.         struct employee *nextPtr;
  18. }employee;
  19.  
  20. void insert(struct employee **sPtr, char[],char[],char[],int,char[],int);
  21. void getvalues(struct employee*,FILE **);
  22. #endif
  23.  
...I am currently working on the getvalues and it does not seem to be working? Can anyone help?
Mar 25 '07 #1
0 1607

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

Similar topics

1
by: Jonnie | last post by:
I am in the process of building an employee database for use by the management team here. They current have Access 97 (I am working on getting them to upgrade to at least 2000). For the most part I...
1
by: Chris Strug | last post by:
Hi, As something of a pet project, I'm looking to develop a tool to track employee holiday (or vacation for those of us in the US) for my company - good for the company (if I get something...
17
by: RSH | last post by:
I am really trying to grasp the concept of OOP as it applies to C#. I am looking at trying to set up a simple Employee Class but I am having trouble conceptualizing what this class should look...
7
by: Deano | last post by:
What's the current thinking about generating your own internal id for each record in a table? In my case I would like to add a field, for internal use within the program, that uniquely tags each...
8
by: King | last post by:
Hi I have following MS Acess query Here is the query ID Name Prgm ID Client ID Date Start Time End Time Minutes C4 Trisha TIP DEK0703 7 /7 /2006...
2
by: Akinyemi | last post by:
I am developing a Payroll Program. I would like the Startup Form of the Program to show an image/icon representing an employee with the actual name of an employee under it or by its side just like...
3
by: Akinyemi | last post by:
I am creating a database in MSAccess 2000 for my Payroll Program I am writing. I want to save an image representing an employee in the record of each employee. I then want to post the name of each...
1
by: bartholomeus | last post by:
Hello all, I would greatly appreciate suggestions on my following PHP4 problem: In PHP5 this works: $employee = $dom->getElementsByTagName('employee')->item(0); In PHP4 this doesn't work:...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.