public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Giovanni Perbellini <perbelli@sci.univr.it>
To: <ecos-discuss@sources.redhat.com>
Subject: [ECOS] Reading txt file
Date: Mon, 28 Apr 2003 10:21:00 -0000	[thread overview]
Message-ID: <33405.157.27.242.174.1051523793.squirrel@profs.sci.univr.it> (raw)
In-Reply-To: <33120.157.27.242.174.1051175678.squirrel@profs.sci.univr.it>

Hi all,
I have a simple program to read from text file.
This is the source code:

source.h

#include <stdio.h>
class source {
	public:
		source();
		FILE *fp_real;
		FILE *fp_imag;
		bool getValue(float *real, float *imag);
};

source.cc

#include "source.h"
source::source() {
	fp_real = fopen("in_real", "r");
	fp_imag = fopen("in_imag", "r");
}
bool source::getValue(float *real, float *imag) {
	bool bool_eof;
	bool_eof = true;
    if (fscanf(fp_real,"%f \n",real) == EOF) {
		//cout << "End of Input Stream: Simulation Stops" << endl;
		bool_eof = false;
	};
    if (fscanf(fp_imag,"%f \n",imag) == EOF){
		//cout << "End of Input Stream: Simulation Stops" << endl;
		bool_eof = false;
	};
	return bool_eof;
}

I compile the file without problem, but when I simulate the file with
arm-elf-gdb (target sim) I get a problem when I read, using fscanf, from
file....the program stops!Where is the error?

Thanks in advance
Best regards.
Giovanni Perbellini



-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

  parent reply	other threads:[~2003-04-28  9:57 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-22 15:53 [ECOS] kernel API Koeller, T.
2003-04-22 16:31 ` Grant Edwards
2003-04-22 21:32 ` Jonathan Larmour
2003-04-23 10:54   ` Sergei Organov
2003-04-23 14:32     ` Nick Garnett
2003-04-23 16:43       ` Sergei Organov
2003-04-23 16:51         ` Jonathan Larmour
2003-04-24  9:15           ` Sergei Organov
2003-04-24  9:35             ` [ECOS] Error with ARM cross-compiler Giovanni Perbellini
2003-04-24 11:22               ` QiangHuang
2003-04-28 10:21               ` Giovanni Perbellini [this message]
2003-04-28 11:30                 ` [ECOS] Reading txt file Andrew Lunn
     [not found]                   ` <010a01c30d89$98e43880$85f21b9d@CDC03>
2003-04-28 17:23                     ` Andrew Lunn
2003-05-01  1:19                       ` Jonathan Larmour

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33405.157.27.242.174.1051523793.squirrel@profs.sci.univr.it \
    --to=perbelli@sci.univr.it \
    --cc=ecos-discuss@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).