473,386 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

segmentation error fprintf in c

1
Hi,


Im trying to write 3 columns to a file but im getting a core dumped error. The line im using is:

fprintf(output1, "%f\t%f\t%f\n",B,sum,eB):

output1 is a pointer
This always works for 2 columns but when i put in 3 it wont.

Can anyone help me?

Mick
May 8 '07 #1
3 1941
Banfa
9,065 Expert Mod 8TB
is output1 initialised to a buffer big enough to contain the output when there are 3 items on the line?
May 9 '07 #2
gpraghuram
1,275 Expert 1GB
Hi,
fprintf takes a file pointer as the first argument.
Are u initializing the file-pointer before calling fprintf?

Thanks
Raghuram
May 9 '07 #3
Banfa
9,065 Expert Mod 8TB
is output1 initialised to a buffer big enough to contain the output when there are 3 items on the line?
Please ignore this, I was clearly already asleep when I wrote it and it is really quite wrong.
May 9 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

21
by: user | last post by:
I just finish writing LAB2 with no errors when compiling, but once i run it, i get "segmentation fault".. i don't know what is wrong, can anyoen tell me what it means and how i can fix it? thx!
1
by: Dawn Minnis | last post by:
Hey guys - this code when called with parameters: driver.o n n 12 12 12 12 12 12 2.6 3.2 is kicking back a segmentation fault. I've read the rest of the postings but am still confused. Can...
6
by: I_have_nothing | last post by:
Hi! I am new in C. I try to use dynamical allocation fuction malloc( ) and realloc( ). I found something strange. After several calling realloc( ), the malloc( ) will give me a Segmentation...
5
by: Fra-it | last post by:
Hi everybody, I'm trying to make the following code running properly, but I can't get rid of the "SEGMENTATION FAULT" error message when executing. Reading some messages posted earlier, I...
19
by: Sameer | last post by:
Hi friends, I am using Mandriva Linux 9.2 and gcc. My source code is, int chunkin ; //no error int i ; for (i=0;i<7225;i++) { chunkin = somedata ;
6
by: SP | last post by:
The following code compiles with no errors, but fails with "Segmentation Fault" when I run it . I tracked the problem down to the code which populates the image.pixel_p array and I assume that the...
14
by: Vlad Dogaru | last post by:
Hello, I am trying to learn C, especially pointers. The following code attempts to count the appearences of each word in a text file, but fails invariably with Segmentation Fault. Please help me...
3
by: wastedhello | last post by:
hi im farely new to programming, doing it for university, but i cant figure out why this isnt working. it comes up with segmentation faults. can anyone help #include <stdio.h> #include...
1
by: samac | last post by:
Hi all, Need some help in c. I have not been in programming for ten years. Here is my problem: From main(), I call a function - a_function(). In a_function(), I call another function...
4
by: spiralfire | last post by:
I wrote a translator, that reads a DIMACS graph format and writes to a simpler format... basically DIMACS format is: c comment p type nodes edges //type is alwats edge on my problems,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.