home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!usc!sdd.hp.com!spool.mu.edu!uwm.edu!rpi!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!uicvm.uic.edu!u17868
- Organization: University of Illinois at Chicago
- Date: Mon, 9 Nov 1992 23:57:22 CST
- From: <U17868@uicvm.uic.edu>
- Message-ID: <92314.235722U17868@uicvm.uic.edu>
- Newsgroups: comp.lang.c
- Subject: largest structure size on pc (in c)
- Lines: 51
-
- my program is listed below. it is very short. All I am trying to do is to
- read from a file. But, I think the problem is that the structure size is too bi
- g. It compiles successfully.I am using Turbo C 2.0. When I run it I get the mes
- sage "Null Pointer Assignment". I tried different ways that is using malloc, wi
- thout malloc, defining structure as a tag and then declaring an instance, but n
- othing helpded. I have 2M RAM on my pc.Anyone has any suggestion send it to
- u17868@uicvm..cc.uic.edu
-
- Thanks,
- Sikander
- ===================my program ============================================
- #include <stdio.h>
- #include <stdlib.h>
- struct {
- int id;
- char date[9];
- char day[10];
- int stime;
- int length;
- char location[10];
- char with_who[10];
- char phone[11];
- char subj[10];
- char note[10];
- int flag;
- }temp;
-
- main()
- {
- int i;
- FILE *file_pointer;
- file_pointer = fopen("activity.dat","rb+");
- fseek(file_pointer,0,0);
-
- for(i=0;i<=4;i++)
- {
- scanf("%d",&temp.id);
- gets(temp.date);
- gets(temp.day);
- scanf("%d",&temp.stime);
- scanf("%d",&temp.length);
- gets(temp.location);
- gets(temp.with_who);
- gets(temp.phone);
- gets(temp.subj);
- gets(temp.note);
- scanf("%d",&temp.flag);
- fwrite(&temp,sizeof(temp),1,file_pointer);
- }
- }
-
-