Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6587393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:54:41+00:00 2026-05-25T16:54:41+00:00

I am trying to run this program to extract some data however I can’t

  • 0

I am trying to run this program to extract some data however I can’t get it to work properly as I get the error : EXC_BAD_ACCESS.

Here is part of the C program where the error is occurring:

*The line where the error occurs is –

 if ( ( iend = oclread() ) == -1 ) printf(" END OF FILE REACHED\n");

which is located at the bottom.

========================================================================

define maxtax 30  
define maxsec 100  
define maxbio 50  
define maxparm 100  
define maxpsec 25 * maxparm  
define idim 360  
define jdim 180  
define kdim 33  
define kdimax 40  
define maxchoice 8

FILE *fp,*fpout,*fplist, *fpwoa;

char cc[2];

int icruise=0, ostation=0, year=0, month=0, day=0;

int hour,longitude,latitude;

int levels,isoor,nparm,ip2[maxparm],iperror[maxparm];  
int htotfig[3],hsigfig[3],hrightfig[3];

int origcfig,origsfig;
char origc[30],origs[30];
int ipip[maxparm],ipi[maxparm],npi;

int nsec;
int stotfig[maxsec],ssigfig[maxsec],srightfig[maxsec];
int seccode[maxsec],secval[maxsec];

int npsec;
int pstotfig[maxpsec],pssigfig[maxpsec],psrightfig[maxpsec];
int psecparm[maxpsec],pseccode[maxpsec],psecval[maxpsec];

int nbio;
int btotfig[maxbio],bsigfig[maxbio],brightfig[maxbio];
int biocode[maxbio],bioval[maxbio];

int ntsets;
int *ntloc,*ntcode,*ntval,*nterr,*ntoerr,*nttotfig,*ntsigfig,*ntrightfig;

int *depth,*zerr,*zoerr,*ztotfig,*zsigfig,*zrightfig;

int *dataval,*derr,*doerr,*dtotfig,*dsigfig,*drightfig;

int isize,zsize;
int ntsetsmax=0, isizemax=0,zsizemax=0;

double tenp[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
                  100000000 };

int sdepth[] = { 0, 10, 20, 30, 50, 75, 100, 125, 150, 200, 250,  
                 300, 400, 500, 600, 700, 800, 900, 1000, 1100,  
                 1200, 1300, 1400, 1500, 1750, 2000, 2500, 3000,  
                 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000,  
                 7500, 8000, 8500, 9000 }; 

 char *namevar[] = { "Temp","Sal","Oxy","Phos","dum5","Sil","dum7",  
                     "NO3","pH","dum10","Chl","dum12","dum13","dum14",  
                     "dum15","dum16","Alk","dum18","dum19","pCO2",  
                     "DIC","BAC","dum25","dum26","dum27","dum28",  
                     "dum29","dum30","dum31","dum32","Trit","He",  
                     "dHE3","dC14","dC13","Arg","Neo","CFC11",  
                     "CFC12","CFC113","O18" };  

  main()
  {
      char filename[80];
      int i=0, j, k, s, jchoice, iend=0;
      int ncast=0;

      printf(" Enter input file name\n");
      scanf("%s",filename);

      if ((fp = fopen(filename,"rb+\0")) == NULL)
      printf("UNABLE TO OPEN FILE\n");

      else {

            printf( "Which variable would you like to see:\n");  
            printf( " 1 - Temperature\n");  
            printf( " 2 - Salinity\n");  
            printf( " 3 - Oxygen\n");  
            printf( " 4 - Phosphate\n");  
            printf( " 6 - Silicate\n");  
            printf( " 8 - Nitrate\n");  
            printf( "11 - Chlorophyll\n");  
            printf( "17 - Alkalinity\n");  
            printf( "20 - pCO2\n");  
            printf( "21 - tCO2\n");  
            printf( "24 - BAC\n");  
            printf( "33 - Tritium\n");  
            printf( "34 - Helium\n");  
            printf( "35 - deltaHE3\n");  
            printf( "36 - deltaC14\n");  
            printf( "37 - deltaC13\n");  
            printf( "38 - Argon\n");  
            printf( "39 - Neon\n");  
            printf( "40 - CFC11\n");   
            printf( "41 - CFC12\n");  
            printf( "42 - CFC113\n");  
            printf( "43 - Oxy18\n");  
            scanf("%d",&jchoice);

/********************************************************

 INITIALIZE DYNAMIC ARRAYS

*********************************************************/

            spacer(1);

  /*   GET USER INFORMATION (NUMBER OF CASTS, OUTPUT FILE NAME) */

            printf(" Enter output file name\n");
            scanf("%s",filename);

            if ((fpout = fopen(filename,"w\0")) == NULL) 
               {
                 printf("UNABLE TO OPEN FILE\n");
               }

            printf(" ENTER NUMBER OF CASTS TO VIEW");
            printf (" (0 FOR ALL CASTS IN FILE)\n");
            if ( (s = scanf("%d",&ncast)) == 0 ) ncast=0;

            if ( ncast == 0 ) ncast=100000000;

/********************************************************

ENTER STANDARD LEVEL DEPTHS, IN CASE THIS IS STANDARD LEVEL DATA

********************************************************/

            for ( j = 0; j < 40; j++ ) *(depth+j)= *(sdepth+j);

            printheader(jchoice);

            while ( !feof(fp) && (i++) < ncast ) 
            {
             if ( ( iend = oclread() ) == -1 ) printf(" END OF FILE REACHED\n");

             else printstation(i,jchoice);
            }

      }

} 

PLease can someone explain the problem as I really need get this done this.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:54:41+00:00Added an answer on May 25, 2026 at 4:54 pm

    Is this to do with reading data from the World Ocean Database?

    If so there’s a sample here of how to use oclread(): http://2bitbrain.blogspot.com/2010/08/sqlite3-and-world-ocean-database.html

    It looks like you will need to #include the header file that prototypes oclread() and call it with appropriate parameters, namely a WOD_Reader * that you have created and set up.

    Does your current code compile and link without errors or warnings?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to run this program but i keep getting the error esent.h
Im doing C homework and trying to get this program to run, but I
I'm trying to compile and run this program .obviously, it doesn't work!my question is
I need some guidance on how best to run this program. Im trying to
I'm trying to run this for loop; for (int col= 0; grid[0].length; col++) However
I am getting this error when trying to run internet information services on a
I've run into this problems several times before when trying to do some html
A buddy of mine has been getting this error mesage when trying to run
When I am trying to run tomcat using startup.bat I get the following error,
I'm trying to run this c++ program I wrote. I'm getting the following errors

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.