safe scanf( ) or gets

M

Malcolm

Sure games are big, and there's money in games. But the real world is >
no game. You better hope the game markets keeps going as I feel you
could not make it in any other field.
What we're finding is that games are taking over a lot of serious
applications. Flight simulators are an obvious example. 3d graphics are
increasingly being used for other non-games, for instance to produce
architectural models. Then games and mobile phone apps are beginning to
merge. Finally, millions of consumers have a games console as their only
general-purpose computer.

However people aren't going to stop playing video games, and we have a fun
environment in which to work.
 
M

Mark McIntyre

Microsoft was saying the same more than 10 years ago. It repeats that
every year new but was never able to get it right.

Which is absurd, given that several other companies sell very good
shells indeed.
 
M

Mark McIntyre

Switch your microphone on, start up voice type, navigate your GUY by
speaking to your computer,

erm, we're using a mobile phone here....
let it open your preferred word
processor/mail program and dictate the text and formatting,

on a /phone/ ?
order it
to print the document, read it, navigate with voice inside the text,
command the correctios, command it to save the document or to mail it
to its destination.
It can be done since 1996.

Yes, I've had speech recognition on my PC since about then. Pile of
junk.
 
F

Flash Gordon

What we're finding is that games are taking over a lot of serious
applications. Flight simulators are an obvious example.

The last I checked (admittedly a good few years ago) the commercial
flight simulators were *very* different beasts to the flight sim games.
For a start, they used several computers for one flight simulator,
secondly they did not have a GUI, all the interfacing being via real
aircraft controls
3d graphics are
increasingly being used for other non-games, for instance to produce
architectural models.

I would be surprised if 3D CAD did not predate 3D games.
Then games and mobile phone apps are beginning
to merge. Finally, millions of consumers have a games console as their
only general-purpose computer.

A games console is not a general purpose computer, it is a very heavily
targeted computer.
However people aren't going to stop playing video games, and we have a
fun environment in which to work.

However most computers will continue to be without GUI interfaces
because most will continue to have no display at all.

To get back to whether there is much done with just stdin/stdout/stderr
interfaces, on computers used for serious work (such as running the
financial applications for some big companies) there are a host of
administrative tasks performed by automation scripts which rely on
programs accepting input from stdin and sending output to stdout. Such
input/output streams being redirected and, when appropriate, the output
being fed in to the input stream of a command line mail client to let
the administrator know there is a problem.

Also command line tools are far better (so the support staff tell me)
when you have to log on to a machine across the internet or a dial up
and fix things.

These tasks may not be what the majority of PC users do, but they still
account for a lot of the real work done on computers.
 
T

The Real OS/2 Guy

erm, we're using a mobile phone here....

Sure that your soundcard ends in your mobile phone instead of
loudspeakers?
on a /phone/ ?

On a microphone. A think that get connected into a soundcard.
Yes, I've had speech recognition on my PC since about then. Pile of
junk.
I don't speak about wincrap.
 
C

Christopher Benson-Manica

Flash Gordon said:
Also command line tools are far better (so the support staff tell me)
when you have to log on to a machine across the internet or a dial up
and fix things.

Just to elaborate: Which do you think is faster - accessing a
computer's desktop graphically via PCAnywhere or some such
application, or accessing a computer via ssh on the command line?
 
M

Malcolm

Grumble said:
Is your being a troll now official, then?
We all like a joke at the expense of Microsoft. However anyone who takes
these jokes seriously has disqualified himself as someone who knows
something about the world of computers.
 
E

E. Robert Tisdale

Something said:
Is your being a troll now official, then?

1. troll handle: Grumble
2. forged email address: (e-mail address removed)
3. attempt to provoke an emotional response: <above>
4. off topic ad hominem attack: against Malcolm

Please don't feed the troll.
 
F

Flash Gordon

Just to elaborate: Which do you think is faster - accessing a
computer's desktop graphically via PCAnywhere or some such
application, or accessing a computer via ssh on the command line?

My personal experience is that a command line interface is much faster
for such things even if you have a broadband connection rather than just
a dial up.
 
E

Eric Boutin

Malcolm said:
We all like a joke at the expense of Microsoft. However anyone who takes
these jokes seriously has disqualified himself as someone who knows
something about the world of computers.

Humm ok that definately tells me how to use stdin securely, thanks
 
R

Richard Heathfield

Eric said:
Humm ok that definately tells me how to use stdin securely, thanks

There has been lots of excellent advice in this thread about how to use
stdin securely, but it's not always easy for an advisee to know which
advisers' advise can be trusted.

If you want to know who you can trust, the only real way to find out is to
read the newsgroup for a while (at least a couple of months). After a
while, you'll find out who gives reasoned opinions, typically backed by
references to the Standard that defines the language, and who doesn't.

Also, you'll find that the real experts tend to recognise each other, and
this is apparent from their discussions. These are the people you can learn
from; trolls need not interfere with your learning too heavily.
 
G

Guest

|> We've seen you knows nothing about real computeing.
|>
| [ snip ]
|>
|> No, I don't use M$ software because M$ has proven itself to be
|> incompatible to anything - even to itself even in standard C.
|>
| I rest my case.

Your case needs a rest. A long rest. Come back in 2038.
 
P

Phong Vo

Eric Boutin said:
Hi ! I was wondering how to quickly and safely use a safe scanf( ) or gets
function... I mean.. if I do :

char a[256];
scanf("%s", a);
and the user input a 257 char string..
that creates a problem.. same for gets..

Get the Sfio library (www.research.att.com/sw/tools/sfio).
It allows you to say something like:
scanf("%I256s",a);
or more dynamically:
scanf("%I*s", sizeof(a), a);
the flag I says that the size of the array will be given next. The * means that
the size is given as an argument.

For gets() type of things, uses the sfgetr() function which does memory allocation
as necessary to get the entire string.
 
E

Eric Boutin

Thanks a LOT !!
I've been searching for something like this since a few days.. thanks a lot
!

-Eric


Phong Vo said:
"Eric Boutin" <[email protected]> wrote in message
Hi ! I was wondering how to quickly and safely use a safe scanf( ) or gets
function... I mean.. if I do :

char a[256];
scanf("%s", a);
and the user input a 257 char string..
that creates a problem.. same for gets..

Get the Sfio library (www.research.att.com/sw/tools/sfio).
It allows you to say something like:
scanf("%I256s",a);
or more dynamically:
scanf("%I*s", sizeof(a), a);
the flag I says that the size of the array will be given next. The * means that
the size is given as an argument.

For gets() type of things, uses the sfgetr() function which does memory allocation
as necessary to get the entire string.
 
A

Arthur J. O'Dwyer

Just for reiteration, it's worth pointing out that the 'I' is
not only redundant, but non-standard. [And the "256" should be
"255" to avoid one-character overflow (after removing the "I").]


And this is a nice extension, but your code will break in
*spectacular* fashion when run on a computer without Sfio's
library in the right place. I would feel much more comfortable
if Sfio hadn't given their scanf-alike the exact same name as
an existing library function.

Probably good advice. I haven't seen the source code yet,
but it's hard to get wrong if you're not *trying*. :)

-Arthur
 
G

Gordon Burditt

No its eccentric. Users generally won't accept command line programs unless
Actually system administrators hate GUI's because they (sysadmins)
sometimes have to do the same thing over and over to many computers, and
what they really want is a way to script the action, while still allowing
a certain number of intelligent variables.

GUIs often have extreme problems of scale. Using a GUI newsreader as
an example, on initially setting one up, you can probably subscribe to
a newsgroup in maybe 4 mouse clicks. The problem is, can you subscribe
to 1000 newsgroups (according to some pattern, like all of the comp.*
newsgroups) in less than 4*1000 mouse clicks?

Gordon L. Burditt
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,137
Messages
2,570,797
Members
47,344
Latest member
KamCrowthe

Latest Threads

Top