LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 02-13-2008, 01:33 PM   #1
ray.shashi
LQ Newbie
 
Registered: May 2007
Posts: 5

Rep: Reputation: 0
segmentation error


Hi
I am using solaris machine in which I use gcc compile.
I am getting segmentation error in the following statement
fprintf(stream_pointer_name, "\t%c16%c16%c16%c16%c", '|','|','|','|','|');
I am trying to print '|' five times in a file at a 16 spacing gap.
Can any one tell me the reason?

Last edited by ray.shashi; 02-13-2008 at 01:34 PM.
 
Old 02-13-2008, 05:43 PM   #2
ehawk
Senior Member
 
Registered: Jul 2003
Posts: 1,257

Rep: Reputation: 48
Not sure....whenever I get a segmentation error, it is normally because I am trying to access a memory location which does not exist.
 
Old 02-13-2008, 05:56 PM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
The segmentation violation is more likely due to something wrong with your stream pointer. There is also a problem with your output format.
Here is something that match your requirements:
Code:
fprintf(fp, "\t%16c%16c%16c%16c%16c", '|','|','|','|','|');
 
Old 02-15-2008, 01:43 PM   #4
ray.shashi
LQ Newbie
 
Registered: May 2007
Posts: 5

Original Poster
Rep: Reputation: 0
Smile

Hi
I got the reason for segmentation error(fault).
Actually I was declaring a pointer n by mistake I
was not allocating the space for that pointer before use
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
segmentation error harbir Programming 5 07-26-2004 03:10 PM
Segmentation error - WHAT??????????? the_rydster Linux - Laptop and Netbook 1 11-16-2003 05:40 PM
Segmentation Error WNxSquee Linux - Software 1 08-15-2003 12:48 PM
Segmentation Error MBtronics Linux - Software 4 07-10-2003 08:09 AM
Segmentation Error Roy-Svork Linux - Software 1 01-08-2003 12:21 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 07:00 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration