delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/07/02/20:45:14

From: jason_hsu AT my-deja DOT com
Newsgroups: comp.os.msdos.djgpp
Subject: Re: SIGSEGV error when reading a file into an array
Date: Sun, 02 Jul 2000 23:53:04 GMT
Organization: Deja.com - Before you buy.
Lines: 47
Message-ID: <8jokkr$gau$1@nnrp1.deja.com>
References: <8jm69n$tj0$1 AT nnrp1 DOT deja DOT com> <qsgvls8vimr5vuhao7ra1jh4c3kmrsoukd AT 4ax DOT com>
NNTP-Posting-Host: 24.18.171.165
X-Article-Creation-Date: Sun Jul 02 23:53:04 2000 GMT
X-Http-User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; DigExt)
X-Http-Proxy: 1.1 x73.deja.com:80 (Squid/1.1.22) for client 24.18.171.165
X-MyDeja-Info: XMYDJUIDjason_hsu
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <qsgvls8vimr5vuhao7ra1jh4c3kmrsoukd AT 4ax DOT com>,
  Sean Proctor <sproctor AT ccs DOT neu DOT edu> wrote:
> >		else if (ch=='\n')
> >			{
> >			row_num++;
> >			col_num=1;
> change above to: col_num = 0;
> >			}

I will give this a try.

> why not reuse fin1?

I tried to reuse fin1, but I was getting error messages.  I suppose I
could have found a way to properly reuse it, but I felt it was easier
to create fin2 for reopening the file.

How can I reuse fin1?  Would this solve my SIGSEGV problem?

> ><< "\nC"<<col_num<<"R"<<row_num<<"\t"<<data_rc[row_num][col_num];
> Huh?  you never do antying to data_rc, ever... why would you output
> one of its elements?

Just one of those value checkers.  It's not necessary for operation,
just debugging.

> >int main ()
> >{
> >	get_data(input_numbers_file_name);
> huh? you didn't list and global variables... and at no point was there
> any reference to input_numbers_file_name... unless you're expecting us
> to translate that to something like "file.ext" in which case... why
> use a string at all?  just use a char[], it's simpler.

This program is far from complete.  The reason for the string input is
that I will be using this function multiple times, as there are several
files I will be getting data from.  Also, I prefer strings to character
arrays.

--
Jason Hsu, KB9PNZ
jason_hsu AT apexmail DOT com
http://www.bigfoot.com/~jason_hsu/


Sent via Deja.com http://www.deja.com/
Before you buy.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019