LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-08-2005, 02:36 AM   #1
dogbird
Member
 
Registered: Nov 2004
Location: oklahoma
Distribution: slackware 9.0
Posts: 98

Rep: Reputation: 15
9.0 slackware lib problem


I am trying to build a compiler and I was trying to read some clear text into string arrays. The lib function is fgets. as I am reading in the file I print the strings. This works just fine. After it finishes, inside the routine, I try to print the strings before I exit, and they are gabled. in fact, it prints ALL of the strings overlaid.

I read a clear text file with fgets. No tricks, no extra code. I read 350 lines.

I noticed that printf( " %s \n" has 2 nl chars. (?) I think one is in the input string. but the documentaion says the strings are \0 delimted. The problem with the strings is there does not seem to be any \0 delimiters.

can someone tell me how to fix this? I even malloc everything. No clues for me in the docs..
josephus
 
Old 11-09-2005, 05:17 PM   #2
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
----------------
but the documentaion says the strings are \0 delimted. The problem with the strings is there does not seem to be any \0 delimiters.
----------------

i guess the documentation sais the strings " have to be " \0 delimited.
you must take care of that yourself.

btw: this is a programming Q.
maybe ask a moderator to move it to the programming forum.

egag
 
Old 11-09-2005, 05:56 PM   #3
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
Or report it to a moderator and ask us that way....?

It's been moved to Programming.
 
Old 11-09-2005, 07:49 PM   #4
egag
Senior Member
 
Registered: Jul 2004
Location: Netherlands
Distribution: Slackware
Posts: 2,721

Rep: Reputation: 53
of course.

egag
 
  


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
/lib/libthread_db.so.1 crashes at shutdown or reboot on Slackware 10.1 with Qt 3.3.4 Basel Slackware 13 07-15-2005 03:03 AM
Slackware 9.1 error /lib/libncurses.so.5 Fang Slackware 4 12-13-2003 06:34 PM
gnome lib problem cyberia_2ooo Slackware 1 05-08-2003 07:17 AM
e17 lib problem iceman47 Linux - General 1 02-24-2003 05:25 AM
lib problem torp Linux - General 3 09-27-2001 01:01 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:44 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