[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

sscanf and struct...

Posted on 1998-09-23
7
Medium Priority
?
647 Views
Last Modified: 2008-03-17
Hi there I've got a problem with a C-programm which uses sscanf to fill a struct with several data.

struct type{char string; double dvar1;} name;
char buffer[82]; double local;
...
main(){
for(loop=0;loop <5;++loop){
...  
gets(buffer);
sscanf(buffer,"%s",&name[loop].string);// works fine
gets(buffer);
sscanf(buffer,"%lf",&name[loop].dvar1);// does not work; error message: floating point formats not linked
//if I use:
gets(buffer);
sscanf(buffer,"%lf",&local);
name[loop].dvar1)=local; //it works fine

can you give me a hint, what I do wrong.( By the way using BC for DOS).
thanx
greetings x-rai
0
Comment
Question by:x_rai
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:danny_pav
ID: 1252983
is that a compiler error or runtime error?
0
 

Author Comment

by:x_rai
ID: 1252984
It 's a runtime error... followed by the comment abnormal termination.
:(

0
 
LVL 3

Expert Comment

by:plaroche
ID: 1252985
How can you use:

name[loop]

when you haven't allocated more than one slot for that structure?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:x_rai
ID: 1252986
It 's a runtime error... followed by the comment abnormal termination.
:(

0
 

Author Comment

by:x_rai
ID: 1252987
>How can you use:
>
>      name[loop]
>
>       when you haven't allocated more than one slot for that structure?
sorry -typed it by head, in the programm it is of course
struct type{char string; double dvar1;} name[5];

But thats not the point
0
 
LVL 3

Accepted Solution

by:
zhongbing earned 200 total points
ID: 1252988
hi.
struct type{char string; double dvar1;} name[5];
should be
..........char string[xxxx];.......
cause you refered it like a string not a single char.
0
 

Author Comment

by:x_rai
ID: 1252989
Hi,
this is a rigth invention, but not the solution to the problem.
Infact I found out that it is a compiler error, from Borland, where the compiler optimizes the executable file as small as possible.
This is solved by inserting
extern void _floatconvert();
#pragma extref _floatconvert()
into the source.
found in the technical information of borland, (with help of Hans-Bernhard Broeker) located at:
http://www.inprise.com/devsupport/borlandcpp/ti/TI645.html
thanks for your help
cheers rai

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial is posted by Aaron Wojnowski, administrator at SDKExpert.net.  To view more iPhone tutorials, visit www.sdkexpert.net. This is a very simple tutorial on finding the user's current location easily. In this tutorial, you will learn ho…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question