need help getting the results of the system function into a variable

V

Vladimir S. Oka

SF said:
Well, since I already have an off topic post where people are nice
enough to reply, adding something to that post is not the worst thing
in the world is it?

Being off topic is being off topic is being off topic...
I do have this posted in other groups. I also said how it could be
viewed as a regular C question since I am not really asking anything
about windows itself but on using a popular API written in C.

I actually have answered the on topic part of your question, the way I
understood it. I may not have understood the question in the first
place, though.
Also I figure that my on subject addition to an off topic thread is as
harmless as your off subject question in that same thread.

I honestly don't know what question of mine you're referring to (my
memory is a fallible device). Can you quote it?

As I already said, the on topic part I have replied to. Even if I wanted
I couldn't help you with the system specific bit (and that is really
the gist of the question), as I generally don't program for hosted
implementations (not for a living anyway).

--
BR, Vladimir

Nirvana? That's the place where the powers
that be and their friends hang out.
-- Zonker Harris
 
R

Richard Bos

The C way to "interface with a function and get its info into a
variable" is to store the return value of the function. If the
information you need is not in the return value of the function

Not necessarily. Some functions "return" multiple values through
pointers passed to them. E.g., fgets() writes the text it reads through
its first argument (and returns an error indicator); strtol() does the
opposite, returning the value it converted, and writing the address
where it stopped converting (one use for which is as an error indicator)
through its second argument.
(e.g. because you want the I/O output performed by the function)

In this specific case, though, you're quite right.

Richard
 
W

Walter Roberson

(e-mail address removed)-cnrc.gc.ca (Walter Roberson) wrote:
Not necessarily. Some functions "return" multiple values through
pointers passed to them. E.g., fgets() writes the text it reads through
its first argument (and returns an error indicator); strtol() does the
opposite, returning the value it converted, and writing the address
where it stopped converting (one use for which is as an error indicator)
through its second argument.

If a function returns a value through a pointer passed into it,
then the function is *putting* the value, which is not compatible
with the user requirement to *get* its information into a variable.
Passive versus active.
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top