473,513 Members | 2,358 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

reading data problems

Hello,

I am trying to read two-dimensional float data into C++, but am
getting a segmentation fault error message. This happens in g++
compiler versions 2.95.2 and 3.1, but not on version 3, each in three
different servers. I need to compile in the latest version. Below I
attach the beginning of the code giving the problem:

# include <iostream>
# include <fstream>

int main()
{
std::ifstream input ; (this is where the problem occurs, i then
go on)

...

input.open("filename") ;

...

}

and so on. Is there a more general/accepted way to do this? Please let
me know if you need more detail. Thanks a lot,
Yesim
Jul 22 '05 #1
1 1127

"Yesim" <ye********@yahoo.com> wrote in message
news:c0**************************@posting.google.c om...
Hello,

I am trying to read two-dimensional float data into C++, but am
getting a segmentation fault error message. This happens in g++
compiler versions 2.95.2 and 3.1, but not on version 3, each in three
different servers. I need to compile in the latest version. Below I
attach the beginning of the code giving the problem:
Why just the 'beginning?'. It would help us help you
better if you'd post the smallest, complete, compilable
program that exhibits the problem.

# include <iostream>
# include <fstream>

int main()
{
std::ifstream input ; (this is where the problem occurs, i then
go on)
What problem? Does a 'segmentation fault' occur at this
point? How do you know?

Your code to this point is perfectly valid.

...

input.open("filename") ;
This line is OK too. (But you should check the stream
state before attempting to read from the file).

...

}

and so on. Is there a more general/accepted way to do this?
Do what? All your posted code does is create a stream
object and attempt to open a file. What you have is the way
to do it.
Please let
me know if you need more detail. Thanks a lot,


We need a complete program, and a more specific description
of what it's supposed to do, and what it actually does.

-Mike
Jul 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3565
by: Andy | last post by:
Hi, In the code below (not pretty I know but it's an early version :-P) I'm having problems reading the data object back in. If I move the reading code to immediately after the section where it...
0
1018
by: Michal Szpadzik | last post by:
I'm a newbie. I have some problems with bits data reading. I have binary data file where data is written as 12bits pack. I need to read it becouse there are saved values which have to processed...
1
7036
by: fabrice | last post by:
Hello, I've got trouble reading a text file (event viewer dump) by using the getline() function... After 200 - 300 lines that are read correctly, it suddenly stops reading the rest of the...
1
2748
by: Boris Wilhelms | last post by:
Hello all, at first, sorry for my bad English, I’ll give my best  We have a strange problem reading Text- and VarChar-Fields. Our configuration: -Windows 2003 Server -MySQL Server 3.23.36...
4
12789
by: Erpman | last post by:
I am trying to access the data with in a wav file. I am testing with very small files in order to keep the code simple to start with. Basically, im writing the entire wav file to a byte using a...
0
961
by: Prasad Dannani | last post by:
Hi, I have some problems in reading xml data using webrequest, response and dataset objects. This program i am executing from last 6 months its worked fine. but now its throwing some exceptions....
0
1004
by: Webster | last post by:
Hello, I have a program that asynchronously reads data from a host. However, whenever I call the BeginRead function, the async reading "loop" never seems to terminate. Why doesn't the EndRead...
1
3695
by: White Spirit | last post by:
I'm trying to use getchar() to read alphanumeric data as follows:- char input; /* Take a string of input and remove all spaces therein */ int j = 0; while ((input = getchar()) != '\n') { if...
5
5056
by: UJ | last post by:
I have a system that has five programs that all communicate with each other via Message Queues. Works well. One program is a watchdog that will make sure the others are up and going. Currently I...
6
5245
by: arne.muller | last post by:
Hello, I've come across some problems reading strucutres from binary files. Basically I've some strutures typedef struct { int i; double x; int n; double *mz;
0
7267
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7391
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7542
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5100
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4754
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3247
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1609
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
809
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.