From: Gregory Nowak <greg@romuald.net.eu.org>
To: Tyler Littlefield <compgeek13@gmail.com>,
"Speakup is a screen review system for Linux."
<speakup@braille.uwo.ca>
Subject: Re: can someone look at this? sorry if its o-t
Date: Fri, 12 May 2006 12:43:37 -0700 [thread overview]
Message-ID: <20060512194337.GA18915@localhost.localdomain> (raw)
In-Reply-To: <002801c675ec$1f8d1870$6501a8c0@grandmasfury>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I don't see any reference to fdata in your code, unless it is defined
somewhere in the header files you include, something I haven't checked
into.
I've tried compiling your code anyway, and found the following:
First, the line that says
dfile=fopen("darg", "w");
has the compiler telling me that dfile is undefined. I'm guessing that
you wanted to write:
FILE *dfile=fopen("darg", "w");
in which case, you should have declared dfile at the top of your
function, following good c/c++ programming practices. Also, when using
fopen, it's a really good idea to check that your pointer is actually
assigned to a open file after you open it.
The next error gcc returns is 4 lines later, saying that dfile isn't a
const char*:
printf(dfile, usr);
I have no clue what you're trying to do here. If you meant to use
dfile as a pointer to an open file, I don't see why you'd want to
print it out to stdout.
I didn't try to fix this farther. Also, I'm wondering why you're
including c++ header files, as if you're fixing to write c++ code, but
then write your code entirely in c? If you're going to do that, then
you might as well include fstream, and use ifstream and ofstream for
file i/o, which in my humble opinion is a heck simpler then using
fopen.
Greg
On Fri, May 12, 2006 at 11:47:17AM -0600, Tyler Littlefield wrote:
> Hay list,
> I know this is off-topic, but it says fdata is out of scope, can someone look at it and tell me what is going on?
> Thanks,
> #include <stdio.h>
> #include <sys/types.h>
> #include <sys/stat.h>
> #include <unistd.h>
> #include <syslog.h>
> #include <cstdlib>
> #include <iostream>
> struct data{
> int alt;
> char *data;
> char *usern;
> };
> using namespace std;
> int main()
> {
> openlog("Dataplus client", LOG_PID, 0);
> switch ( fork() ) {
> case -1:
> syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "There was an error starting the dataplus client.");
> return 1;
> case 0:
> break;
> return 0;
> }
> if ( setsid() < 0 )
> {
> syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "There was an error starting the dataplus client.");
> return 2;
> }
> syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_NOTICE), "Dataplus client ready.");
> data usr;
> usr.alt=322;
> usr.data="linux";
> usr.usern="tyler/root";
> dfile=fopen("darg", "w");
> int i;
> for (i = 0; i++; i < 12)
> {
> printf(dfile, usr);
> fflush(dfile);
> }
> fclose(dfile);
> return 0;
> }
> _______________________________________________
> Speakup mailing list
> Speakup@braille.uwo.ca
> http://speech.braille.uwo.ca/mailman/listinfo/speakup
- --
web site: http://www.romuald.net.eu.org
gpg public key: http://www.romuald.net.eu.org/pubkey.asc
skype: gregn1
(authorization required, add me to your contacts list first)
- --
Free domains: http://www.eu.org/ or mail dns-manager@EU.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
iD8DBQFEZOVp7s9z/XlyUyARAh9CAJ9gOc46dlTB6Vouc1d/VfHpp0PQBwCfZhTa
0uvKvuFwOazS2T6NGgqZ964=
=zlEo
-----END PGP SIGNATURE-----
prev parent reply other threads:[~ UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
Tyler Littlefield
` Gregory Nowak [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060512194337.GA18915@localhost.localdomain \
--to=greg@romuald.net.eu.org \
--cc=compgeek13@gmail.com \
--cc=speakup@braille.uwo.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).