473,944 Members | 17,311 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Employee Program problem only part

1 New Member
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 1640

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

Similar topics

1
1747
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 have it under control. There are several points that have popped up as wanted features and I need to verify somethings. 1. We now want to add the ability to add comments/notes with time and date stamps to an employees record. These comments...
1
14949
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 usuable working) and good practice for me. Before I even open Access I want to get the relationships sorted. First looks indicate two basic entities:
17
19330
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 like. I was hoping someone might be able to simply outline what I envision my class to look like: Basically I am envisioning a Class called Employee: I imagine it would have many properties(?) such as:
7
6281
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 employee record. There was never any need to capture an employee number to try to distinguish records, I just need to be able to find a record that refers to a specific employee. I was thinking of randomising a number and maybe adding some...
8
4027
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 10:00:00 AM 12:00:00 PM 120
2
2132
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 you see icons on the desktop of Windows operating system when you power up your PC. The image/icon will be the same for all the employees. The only thing that diffrentiates one image/icon from the other is the name of an actual employee that is...
3
1552
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 employee and the image I have save in each record of each employee on Visual Basic Form. How do I do this? I need your help. Akinyemi
1
2193
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: $employee = $dom->get_elements_by_tagname('employee')->item(0);
0
9974
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11140
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11317
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10679
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8239
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7402
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4927
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.