LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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

Tags used in this thread
Popular LQ Tags , , , , , , ,

Reply
 
Thread Tools
Old 10-02-2009, 05:23 PM   #1
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,233
Thanked: 59
ironing out the bugs in my kernel--need make few functions-dont know how they work


[Log in to get rid of this advertisement]
ok i have my kernel booting loading and printing on screen
now i need to make fscanf, sscanf and sprintf
does anybody know how they work
windows_vista smeezekitty is offline  
Tag This Post , , , , , , ,
Reply With Quote
Old 10-02-2009, 07:43 PM   #2
orgcandman
Member
 
Registered: May 2002
Location: dracut MA
Distribution: openSUSE 11.1; Pebble; PNE-LE; LFS (no book)
Posts: 382
Thanked: 12
They use varargs.

There's a pretty famous example. In fact, you might even be able to google the following phrase

Quote:
Wirzenius wrote this portably, Torvalds XXXXed it up
Note: XXXX is substituted for an expletive beginning with the letter f.
orgcandman is offline     Reply With Quote
Old 10-02-2009, 07:48 PM   #3
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,233
Thanked: 59

Original Poster
Quote:
Wirzenius wrote this portably, Torvalds XXXXed it up
Note: XXXX is substituted for an expletive beginning with the letter f.
is that a joke!?
windows_vista smeezekitty is offline     Reply With Quote
Old 10-02-2009, 07:49 PM   #4
orgcandman
Member
 
Registered: May 2002
Location: dracut MA
Distribution: openSUSE 11.1; Pebble; PNE-LE; LFS (no book)
Posts: 382
Thanked: 12
http://www.google.com/#hl=en&q=Wirze...15299a959dbb33

2nd link in google goes to vsprintf.c
orgcandman is offline     Reply With Quote
Old 10-02-2009, 08:14 PM   #5
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,233
Thanked: 59

Original Poster
LHOL
now i have another problem with the code
vsprintf.c needs strnlen but i dont even know what it does much less have it in the kernel
windows_vista smeezekitty is offline     Reply With Quote
Old 10-02-2009, 09:04 PM   #6
lutusp
Member
 
Registered: Sep 2009
Distribution: Fedora
Posts: 835
Thanked: 136
Quote:
Originally Posted by smeezekitty View Post
LHOL
now i have another problem with the code
vsprintf.c needs strnlen but i dont even know what it does much less have it in the kernel
More programming by newsgroup?

Code:
$ man strnlen
linuxfedora lutusp is offline     Reply With Quote
Old 10-02-2009, 09:41 PM   #7
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,233
Thanked: 59

Original Poster
it doesnt work
i worked it into the kernel and it just freezes at the sprintf call
then i tried it out of the kernel still didnt work quite right
windows_vista smeezekitty is offline     Reply With Quote
Old 10-02-2009, 11:07 PM   #8
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,233
Thanked: 59

Original Poster
here i will post my code:
Code:
#include <string.h>
#include <vsprintf.c>
extern void printf(char *, ...);
int main(){
char buffer[665];
sprintf(buffer, "hello world %d\n", 123);
printf("\n%s\n", buffer);
}
windows_vista smeezekitty is offline     Reply With Quote
Old 10-03-2009, 07:58 AM   #9
johnsfine
Senior Member
 
Registered: Dec 2007
Posts: 1,668
Thanked: 178
printf and all the things it calls directly or indirectly adds up to a lot of library routines.

From your other threads, I got the idea you were linking without standard libraries. Where are all those library functions coming from? If you let the (Turbo C) library functions into your link, it will be quite a bit of effort to catch and correct all the things that depend on DOS. If you don't, then the likely bugs are in the replacements you've coded for those library routines. Either way, posting your top level code is nearly useless.

Also, where did you get vsprintf.c? Is it a copy compatible with your 16 bit environment? Including a .c file in another .c file sometimes causes problems. I think you said you were using .cpp. Including a .c file in a .cpp is even more likely to cause problems.
linux johnsfine is offline     Reply With Quote
Old 10-03-2009, 12:42 PM   #10
smeezekitty
Senior Member
 
Registered: Sep 2009
Location: washington U.S.
Distribution: Damn Small Linux, KateOs, M$ Ickdows Vista, My own OS
Posts: 1,233
Thanked: 59

Original Poster
i ended up writing my own
still need to figure out the *scanf() functions
windows_vista smeezekitty is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
php image functions dont work ihopeto Linux - Server 4 11-14-2006 03:51 AM
'make' and 'make install' commands dont work on my system? ginda Linux - Newbie 9 04-18-2004 12:17 PM
ifconfig dont work with new kernel neozero62 Linux - Networking 4 11-05-2003 09:47 AM
new kernel modem dont work demmylls Linux - General 4 10-08-2003 06:22 AM
After kernel update some things dont work Vencalator Linux - Newbie 9 09-18-2003 05:10 AM


All times are GMT -5. The time now is 06:39 AM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration