![]() |
| | #1 |
| Guest
Posts: n/a
| i need a good reference(s) to binary files. if anyone knows of one or some, could you please let me know. tnx, ben |
|
| | #2 |
| Code Goddess Join Date: Sep 2001
Posts: 9,664
| What kind of reference information do you need? -Prelude
__________________ My best code is written with the delete key. |
| Prelude is offline | |
| | #3 |
| Guest
Posts: n/a
| just examples um, i just need to see a bunch of examples just want to get a quick look at the way things are done in terms of programming with binary files i hope this has made a bit more clear. tnx, ben |
|
| | #4 |
| Code Goddess Join Date: Sep 2001
Posts: 9,664
| Okay, fiddle around with this for starters ![]() Code: #include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct Record
{
char name[80];
} static sRec[3];
int main ( void )
{
FILE *fp;
strcpy ( sRec[0].name, "Julienne Walker" );
strcpy ( sRec[1].name, "Danny Raxter" );
strcpy ( sRec[2].name, "Amir Salyen" );
if ( ( fp = fopen ( "tst.txt", "wb" ) ) != NULL ) {
(void)fwrite ( sRec, sizeof ( struct Record ), (size_t)3, fp );
(void)fclose ( fp );
}
if ( ( fp = fopen ( "tst.txt", "rb" ) ) != NULL ) {
(void)fread ( sRec, sizeof ( struct Record ), (size_t)1, fp );
(void)fclose ( fp );
}
return EXIT_SUCCESS;
}
__________________ My best code is written with the delete key. |
| Prelude is offline | |
| | #5 |
| +++ OK NO CARRIER Join Date: Oct 2001
Posts: 10,640
| Why are you casting the return value of your functions to void? Just curious, as there is no logical reason to do this. Quzah.
__________________ Hundreds of thousands of dipshits can't be wrong. Are you up for the suck? |
| quzah is offline | |
| | #6 |
| Code Goddess Join Date: Sep 2001
Posts: 9,664
| >Why are you casting the return value of your functions to void? Because I like to see Lint say 'no warnings' ![]() -Prelude
__________________ My best code is written with the delete key. |
| Prelude is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Getting an error with OpenGL: collect2: ld returned 1 exit status | Lorgon Jortle | C++ Programming | 6 | 05-08-2009 08:18 PM |
| how to copy binary files using Unix API's | rohan_ak1 | C Programming | 25 | 05-07-2008 09:12 AM |
| Merge Binary Files | chinook86 | C Programming | 7 | 01-21-2008 02:19 PM |
| Textbox | maxorator | Windows Programming | 20 | 09-25-2005 10:04 AM |
| Decimal to binary conversion help needed | Unregistered | C Programming | 6 | 02-06-2002 01:03 PM |