Hey guys, I would like some help regarding saving or reading to or from a bin file. I've read several online tutorials about file input/output, however it doesn't given specific information when applying it to both an array of structures. My knowledge of pointers is weak, as I constantly need to look over examples to get an idea of whats going on. Heres my attempt: [CODE] #define PLANET_SIZE 10 /* Called from function */ save(planet_t writePlanet[], *totalSize); /* define as int* totalSize */ read(planet_t *writePlanet); typedef struct{ char name[20]; }planet_t; /* Save to file */ void save(planet_t writePlanet[], int totalSize){ …

Member Avatar
Member Avatar
+0 forum 7

Is this a "typedef" problem? This is the definition in one file. typedef BYTE SOCKET; //Socket descriptor BYTE is defined elsewhere as type char. (I made sure the file where SOCKET is assigned a type is included in the file the problem is in.) This is one place it is used but my compiler is saying "BerkeleyTCPServerDemo.c:83:19: error: 'bsdServerSocket' undeclared (first use in this function)" in the following (line 83 equates to the third line in this excerpt)... void BerkeleyTCPServerDemo(void) { static SOCKET bsdServerSocket; static SOCKET ClientSock[MAX_CLIENT]; struct sockaddr_in addr; struct sockaddr_in addRemote; int addrlen = sizeof(struct sockaddr_in); char bfr[15]; …

Member Avatar
Member Avatar
+0 forum 6

I had a doubt in one of the usages of typedef. I want to know the meaning of this line: typedef char Text[80]; What is the meaning of this line and what does it do? Does it create an array of typedefs relating to char, or does it mean "Text means a string of size 80". Thank you in advance! :D

Member Avatar
Member Avatar
+0 forum 2

My understanding of the C language is that the same identifier cannot be reused. However, the code below compiles on GCC without complaints, even when using the "-Wall -pedantic" flags. Is there something that I am missing? Does the standard say anything about functions/macros having the same name as typedef'd types? #include <stdio.h> typedef int error; #define init() error var_error = -6 #define error() ((const error)var_error) int main(void) { init(); printf("error() = %d\n", error()); return 0; }

Member Avatar
Member Avatar
+0 forum 2

Hi. As far as I know, [B]typedef[/B] is used to assign an alias for a structure or type of data, am I wrong? Is there something more to know about Typedef? thanks

Member Avatar
Member Avatar
+0 forum 2

The End.