473,320 Members | 1,828 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Declared global variable isn't being seen by main.

Can someone tell me why giv_len isn't being seen in this statement
below "printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len)"

=cut

#include <stdio.h>
#include <stdlib.h>

char delimiter = '\n';
unsigned long long int cur_len = 0L;
int giv_len;
unsigned long int record = 0L;

int main(int argc, char *argv[])
{
char* infile = argv[1];
char* outfile = argv[2];
giv_len = atoi(argv[3]);
printf("giv_len is :%d\n",giv_len);

FILE* i = fopen(infile,"r");
FILE* o = fopen(outfile,"w");
int ch;
while((ch=fgetc(i) ) != EOF) {
++cur_len;

if(ch == delimiter) {
++record;
/*printf("%d\n",cur_len); */
if(cur_len != giv_len) {
printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len);
fprintf(o,"Record %d wrong length:%d\n",record,cur_len);
}
cur_len=0;
}
}
fclose(i);
fclose(o);
return 0;
}
Mar 14 '08 #1
22 1472
Tr***********@gmail.com wrote:
Can someone tell me why giv_len isn't being seen in this statement
below "printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len)"
The answer is "because you lied to printf() by telling it that the cur_len
variable was an int".

Correct your printf() statement format string to reflect the fact that the
second variable value is an unsigned long long, and your problem should go
away.
=cut

#include <stdio.h>
#include <stdlib.h>

char delimiter = '\n';
unsigned long long int cur_len = 0L;
int giv_len;
unsigned long int record = 0L;

int main(int argc, char *argv[])
{
char* infile = argv[1];
char* outfile = argv[2];
giv_len = atoi(argv[3]);
printf("giv_len is :%d\n",giv_len);

FILE* i = fopen(infile,"r");
FILE* o = fopen(outfile,"w");
int ch;
while((ch=fgetc(i) ) != EOF) {
++cur_len;

if(ch == delimiter) {
++record;
/*printf("%d\n",cur_len); */
if(cur_len != giv_len) {
printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len);
fprintf(o,"Record %d wrong length:%d\n",record,cur_len);
}
cur_len=0;
}
}
fclose(i);
fclose(o);
return 0;
}
--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576
http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Mar 14 '08 #2
changed to the following:

printf("Record %lu wrong length:%llu Should be %d
\n",record,cur_len,giv_len);

to no avail
On Mar 13, 8:32 pm, Lew Pitcher <lpitc...@teksavvy.comwrote:
Tristin.Co...@gmail.com wrote:
Can someone tell me why giv_len isn't being seen in this statement
below "printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len)"

The answer is "because you lied to printf() by telling it that the cur_len
variable was an int".

Correct your printf() statement format string to reflect the fact that the
second variable value is an unsigned long long, and your problem should go
away.
=cut
#include <stdio.h>
#include <stdlib.h>
char delimiter = '\n';
unsigned long long int cur_len = 0L;
int giv_len;
unsigned long int record = 0L;
int main(int argc, char *argv[])
{
char* infile = argv[1];
char* outfile = argv[2];
giv_len = atoi(argv[3]);
printf("giv_len is :%d\n",giv_len);
FILE* i = fopen(infile,"r");
FILE* o = fopen(outfile,"w");
int ch;
while((ch=fgetc(i) ) != EOF) {
++cur_len;
if(ch == delimiter) {
++record;
/*printf("%d\n",cur_len); */
if(cur_len != giv_len) {
printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len);
fprintf(o,"Record %d wrong length:%d\n",record,cur_len);
}
cur_len=0;
}
}
fclose(i);
fclose(o);
return 0;
}

--
Lew Pitcher

Master Codewright & JOAT-in-training | Registered Linux User #112576http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Mar 14 '08 #3
I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.

Any way I can work around this and get the long long?
On Mar 13, 8:40 pm, Tristin.Co...@gmail.com wrote:
changed to the following:

printf("Record %lu wrong length:%llu Should be %d
\n",record,cur_len,giv_len);

to no avail

On Mar 13, 8:32 pm, Lew Pitcher <lpitc...@teksavvy.comwrote:
Tristin.Co...@gmail.com wrote:
Can someone tell me why giv_len isn't being seen in this statement
below "printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len)"
The answer is "because you lied to printf() by telling it that the cur_len
variable was an int".
Correct your printf() statement format string to reflect the fact that the
second variable value is an unsigned long long, and your problem should go
away.
=cut
#include <stdio.h>
#include <stdlib.h>
char delimiter = '\n';
unsigned long long int cur_len = 0L;
int giv_len;
unsigned long int record = 0L;
int main(int argc, char *argv[])
{
char* infile = argv[1];
char* outfile = argv[2];
giv_len = atoi(argv[3]);
printf("giv_len is :%d\n",giv_len);
FILE* i = fopen(infile,"r");
FILE* o = fopen(outfile,"w");
int ch;
while((ch=fgetc(i) ) != EOF) {
++cur_len;
if(ch == delimiter) {
++record;
/*printf("%d\n",cur_len); */
if(cur_len != giv_len) {
printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len);
fprintf(o,"Record %d wrong length:%d\n",record,cur_len);
}
cur_len=0;
}
}
fclose(i);
fclose(o);
return 0;
}
--
Lew Pitcher
Master Codewright & JOAT-in-training | Registered Linux User #112576http://pitcher.digitalfreehold.ca/ | GPG public key available by request
---------- Slackware - Because I know what I'm doing. ------
Mar 14 '08 #4
Tr***********@gmail.com wrote:
I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.

Any way I can work around this and get the long long?
<top post snipped>

This is a well known "interoperability issue" between MinGW and
Microsoft's C runtime library. MinGW's compiler, gcc, supports long
long while the C library it links to by default (Microsoft's CRT) does
not support almost any C99 features, including long long. Thus printf
(which is part of CRT) displays the value incorrectly.

The fix is to use a compiler and C library that agree with each other.
An alternative to MinGW on Windows may be Cygwin, or DJGPP.

Mar 14 '08 #5
On Thu, 13 Mar 2008 18:44:34 -0700 (PDT), Tr***********@gmail.com
wrote:
>I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.
If you compiler doesn't support long long, your object declarations
should result in a compile time diagnostic. Have you set the warning
level to the appropriate level?
>Any way I can work around this and get the long long?
Why? unsigned long is guaranteed to support a value of at least 2G.
Are you planning on testing with a larger file?
>

On Mar 13, 8:40 pm, Tristin.Co...@gmail.com wrote:
>changed to the following:

printf("Record %lu wrong length:%llu Should be %d
\n",record,cur_len,giv_len);

to no avail
It would be nice if you told us what output you were expecting and
what you actually received.
>>
On Mar 13, 8:32 pm, Lew Pitcher <lpitc...@teksavvy.comwrote:
Tristin.Co...@gmail.com wrote:
Can someone tell me why giv_len isn't being seen in this statement
below "printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len)"
The answer is "because you lied to printf() by telling it that the cur_len
variable was an int".
Correct your printf() statement format string to reflect the fact that the
second variable value is an unsigned long long, and your problem should go
away.
=cut
#include <stdio.h>
#include <stdlib.h>
char delimiter = '\n';
unsigned long long int cur_len = 0L;
int giv_len;
unsigned long int record = 0L;
int main(int argc, char *argv[])
{
char* infile = argv[1];
char* outfile = argv[2];
giv_len = atoi(argv[3]);
Will the value you provide in argv[3] fit in an int?
printf("giv_len is :%d\n",giv_len);
FILE* i = fopen(infile,"r");
FILE* o = fopen(outfile,"w");
Don't you think you ought to check to make sure both streams are
actually open?
int ch;
while((ch=fgetc(i) ) != EOF) {
++cur_len;
if(ch == delimiter) {
++record;
You planning on supporting a file with 2G records?
/*printf("%d\n",cur_len); */
if(cur_len != giv_len) {
printf("Record %d wrong length:%d Should be %d
\n",record,cur_len,giv_len);
You changed this one -
fprintf(o,"Record %d wrong length:%d\n",record,cur_len);
but you forgot to change this one. Neither record nor cur_len are of
type int as promised by the %d specifications.
}
cur_len=0;
}
}
fclose(i);
fclose(o);
return 0;
}

Remove del for email
Mar 14 '08 #6
I'm using files that can potentially be several terabytes. My first
test file was over 232GB. I had to compile with the -
D_FILE_OFFSET_BITS=64 flag just to be able to open it. I'm getting
relatively good performance though, over 1GB a minute. Here's an
example of the output.

Record 201 exceeds maximum length:3192066904
Record 301 exceeds maximum length:4009622504

Yes the value provided to argv[3] will fit into an int. Our products
have a max length of a record so it'll never be bigger than 102400
bytes. This app should really help. Try searching through 500GB for a
single bad record. :)

Here's the actual "finished" code Maybe someone else can get some use
out of it or tell me some way to optimize it further.

=cut

#include <stdio.h>
#include <stdlib.h>
#include <getopt.h>

/* Unsure if these are really needed */
#define _FILE_OFFSET_BITS 64
#define _LARGEFILE_SOURCE

/* you must use the compiler flag -D_FILE_OFFSET_BITS=64 on linux
so that it is possible to open/parse files larger than 2GB

2008 March 13
*/
int debug = 0;

void help();

char delimiter = '\n';
unsigned long int cur_len = 0L;
int giv_len = 0;
unsigned long int record = 0L;

int main(int argc, char *argv[])
{
char* infile = NULL;
char* outfile = NULL;
giv_len = 0;

if(debug) {
int i = 0;
for(i=0;i<argc;i++) {
printf("%s\n",argv[i]);
}
}

if(argc == 1) {
help();
exit(0);
}

int option;
/* Parse Our options
************************************************** *********/
while( (option=getopt(argc,argv,"i:o:l:h")) != -1 ) {
switch(option) {
case 'i':
infile = optarg;
break;
case 'o':
outfile = optarg;
break;
case 'l':
giv_len = atoi(optarg);
break;
case 'h':
help();
break;
case '?':
printf("Unknown argument:%c\n",optopt);
exit(2);
break;
case ':':
printf("Option %c requires an argument\n",optopt);
exit(2);
break;

}
}

FILE* i;
FILE* o;

if( (( i = fopen(infile,"r") ) == NULL ) || ( o =
fopen(outfile,"w") ) == NULL) {
printf("You must specify a valid input and output file\n");
perror("Error");
exit(2);
}

if(giv_len == 0) {
printf("You must give a [maximum] record length\n");
exit(2);
}

int ch;
while((ch=fgetc(i) ) != EOF) {
++cur_len;

if(ch == delimiter) {
++record;

if(cur_len giv_len) {
printf("Record %lu exceeds maximum length:%lu
\n",record,cur_len);
fprintf(o,"Record %lu exceeds maximum length:%lu
\n",record,cur_len);
}
cur_len=0;
}
}
fclose(i);
fclose(o);
return 0;
}

void help() {
printf("\n");
printf("Variable Length File Verifier:\n");
printf("-i file The name of the input file\n");
printf("-o file The name of the output file\n");
printf("-l length The max number of bytes per record\n");
printf("-h This screen\n");
printf("\n");
printf("Example: variable.exe -i 99999.SO01 -o badrecords.txt -l
102400\n");
printf("\n");
printf("\n");
}

Mar 14 '08 #7
On Mar 13, 8:44 pm, Tristin.Co...@gmail.com wrote:
I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.
http://www.mingw.org/MinGWiki/index.php/long%20long
Mar 14 '08 #8
santosh <sa*********@gmail.comwrites:
Tr***********@gmail.com wrote:
>I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.

Any way I can work around this and get the long long?

<top post snipped>

This is a well known "interoperability issue" between MinGW and
Microsoft's C runtime library. MinGW's compiler, gcc, supports long
long while the C library it links to by default (Microsoft's CRT) does
not support almost any C99 features, including long long. Thus printf
(which is part of CRT) displays the value incorrectly.

The fix is to use a compiler and C library that agree with each other.
An alternative to MinGW on Windows may be Cygwin, or DJGPP.
Really? I've heard that MinGW has an inconsistency in the
representation of long double supported by the compiler vs. the
representation expected by the (MS-provided) runtime library. I
hadn't heard that there was an issue with long long. You could well
be right, of course.

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Mar 14 '08 #9
Barry Schwarz <sc******@dqel.comwrites:
On Thu, 13 Mar 2008 18:44:34 -0700 (PDT), Tr***********@gmail.com
wrote:
>>I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.

If you compiler doesn't support long long, your object declarations
should result in a compile time diagnostic. Have you set the warning
level to the appropriate level?
If the compiler supports long long, but the runtime library doesn't
(in particular, if printf doesn't support the "%llu" format), then you
could have problems that don't show up as compiler error messages. I
know that MinGW, which combines a compiler and a runtime library from
two different sources, has this kind of problem with long double; it
might have a similar problem with long long.

[snip]

Tristin, please don't top-post. Read the following:

http://www.caliburn.nl/topposting.html
http://www.cpax.org.uk/prg/writings/topposting.php

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Mar 14 '08 #10
ym******@gmail.com writes:
On Mar 13, 8:44 pm, Tristin.Co...@gmail.com wrote:
>I think i figured it out. I'm on a windows box(using minGW). maybe it
doesn't support long long b/c when i change it to just unsigned long
and change the format accordingly, it works.

http://www.mingw.org/MinGWiki/index.php/long%20long
D'oh! I just posted two followups speculating on whether that might
be a problem; I could have saved the effort if I'd just read the
entire thread first. <EMILY_LITELLS>Never mind.</EMILY_LITELLA>

--
Keith Thompson (The_Other_Keith) <ks***@mib.org>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Mar 14 '08 #11
Tr***********@gmail.com wrote:
I'm using files that can potentially be several terabytes.

Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>
Mar 14 '08 #12
"Default User" <de***********@yahoo.comwrites:
Tr***********@gmail.com wrote:
>I'm using files that can potentially be several terabytes.


Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>
You posted this at 25 past 5 or so. Did you really not see Santosh's and
keith's admonishments from 20 minutes earlier? And dont come out with
that "my news server was behind" nonsense.

Please stop spamming this NG with your petty net nannying. If you wish
to continue doing this please at least post something pertinent to the
question as Keith has the common sense to do.
Mar 14 '08 #13
Barry Schwarz wrote:
Tr***********@gmail.com wrote:
>I think i figured it out. I'm on a windows box(using minGW).
maybe it doesn't support long long b/c when i change it to just
unsigned long and change the format accordingly, it works.

If you compiler doesn't support long long, your object
declarations should result in a compile time diagnostic. Have
you set the warning level to the appropriate level?
Not if the problem is in the linked library. Then problems may
show up in the linking step only.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com

Mar 14 '08 #14
You posted this at 25 past 5 or so. Did you really not see Santosh's and
keith's admonishments from 20 minutes earlier? And dont come out with
that "my news server was behind" nonsense.
I am using google groups to post and yes, there IS a lag. Do a post
and refresh a few times. It can take up to 10 minutes for your comment
to post and I imagine it can take just as long for someone else's post
to show.
Please stop spamming this NG with your petty net nannying. If you wish
to continue doing this please at least post something pertinent to the
question as Keith has the common sense to do.
I apologize for spamming the newsgroup and I'll chop and bottom post
from now on, but for someone so insistent on netequette, you sure
could learn a little tact yourself.

Mar 14 '08 #15
Tr***********@gmail.com writes:
>You posted this at 25 past 5 or so. Did you really not see Santosh's and
keith's admonishments from 20 minutes earlier? And dont come out with
that "my news server was behind" nonsense.

I am using google groups to post and yes, there IS a lag. Do a post
I did not reply to you.
and refresh a few times. It can take up to 10 minutes for your comment
to post and I imagine it can take just as long for someone else's post
to show.
>Please stop spamming this NG with your petty net nannying. If you wish
to continue doing this please at least post something pertinent to the
question as Keith has the common sense to do.

I apologize for spamming the newsgroup and I'll chop and bottom post
from now on, but for someone so insistent on netequette, you sure
could learn a little tact yourself.
See comment above.

The post I replied to was:

,----
| From: "Default User" <de***********@yahoo.com>
| Subject: Re: Declared global variable isn't being seen by main. - TPA
| Newsgroups: comp.lang.c
| Date: 14 Mar 2008 17:24:41 GMT
| User-Agent: XanaNews/1.17.5.9
|
| Tr***********@gmail.com wrote:
|
| I'm using files that can potentially be several terabytes.
|
|
| Please don't top-post. Your replies belong following or interspersed
| with properly trimmed quotes. See the majority of other posts in the
| newsgroup, or:
| <http://www.caliburn.nl/topposting.html>
`----

Feel no need to apologise - if you thought I was referring to you then
you have every right to feel miffed. As it was I was defending you if
anything.

The poster I replied to spends his whole day policing peoples posts and
telling people what they can post and how they should do it. It's
painful to watch so I felt like giving him a prod in the ribs.

Mar 14 '08 #16
Tr***********@gmail.com wrote:

Please stop spamming this NG with your petty net nannying. If you
wish to continue doing this please at least post something
pertinent to the question as Keith has the common sense to do.

I apologize for spamming the newsgroup and I'll chop and bottom post
from now on, but for someone so insistent on netequette, you sure
could learn a little tact yourself.

I doubt the message was directed towards you. I believe the person
meant me. At any rate, apparently from someone I killfiled. I'd guess
Richard or Kenny.


Brian
Mar 14 '08 #17
Tr***********@gmail.com said:
>
>You posted this at 25 past 5 or so. Did you really not see Santosh's and
keith's admonishments from 20 minutes earlier? And dont come out with
that "my news server was behind" nonsense.

I am using google groups to post and yes, there IS a lag.
Oh, pay him no mind. He wasn't actually replying to you, but because your
news server was behind, you didn't see the article to which he was
actually responding, so naturally you thought he was responding to you.
You have, in fact, demonstrated that his sentence 'And dont come out with
that "my news server was behind" nonsense' was itself nonsense - some
servers *do* lag.
Do a post
and refresh a few times. It can take up to 10 minutes for your comment
to post and I imagine it can take just as long for someone else's post
to show.
Right. But why confuse a troll with facts?

<snip>

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Mar 14 '08 #18
Tr***********@gmail.com wrote:
>
>You posted this at 25 past 5 or so. Did you really not see
Santosh's and keith's admonishments from 20 minutes earlier? And
dont come out with that "my news server was behind" nonsense.

I am using google groups to post and yes, there IS a lag. Do a
post and refresh a few times. It can take up to 10 minutes for
your comment to post and I imagine it can take just as long for
someone else's post to show.
You are in fairly good shape, having stopped the top-posting. You
also need to ensure that you do not snip attributions for material
you quote. (Attributions are the initial "joe wrote:" lines in a
message.)

Bear two more factors in mind. Some users may respond almost
instantly. Others wait until they get around to it. This is after
possible transmission delays. Google is just another newsreader,
with serious faults, attached to the Usenet system.

A last point: You are responding to a notorious troll. That
particular 'Richard' is plonked by many here.

--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.

--
Posted via a free Usenet account from http://www.teranews.com

Mar 15 '08 #19
CBFalconer wrote:

<snip>
[...] Google is just another newsreader,
with serious faults, attached to the Usenet system.
Google Groups is a newsreader as well as a news server. It also archives
most of Usenet's text groups.

<snip>

Mar 15 '08 #20
santosh wrote:
CBFalconer wrote:

<snip>
[...] Google is just another newsreader,
with serious faults, attached to the Usenet system.

Google Groups is a newsreader as well as a news server. It also
archives most of Usenet's text groups.
And doesn't do any of that very well.


Brian
Mar 16 '08 #21
Default User wrote:
santosh wrote:
>CBFalconer wrote:

<snip>
[...] Google is just another newsreader,
with serious faults, attached to the Usenet system.

Google Groups is a newsreader as well as a news server. It also
archives most of Usenet's text groups.

And doesn't do any of that very well.
I agree about the front-end and I don't have the knowledge or
qualifications to judge the server part, but can you tell me if there
any other even better Usenet archivers?

Mar 17 '08 #22
santosh wrote:
Default User wrote:
santosh wrote:
CBFalconer wrote:

<snip>

[...] Google is just another newsreader,
with serious faults, attached to the Usenet system.

Google Groups is a newsreader as well as a news server. It also
archives most of Usenet's text groups.
And doesn't do any of that very well.

I agree about the front-end and I don't have the knowledge or
qualifications to judge the server part, but can you tell me if there
any other even better Usenet archivers?

You seem to have confused "doesn't do something well" with "doesn't do
something as well as others". There are no other archives as complete
as Google's that I'm aware of. However, their archive is not only not
complete, it's been losing messages that previously were in the
archive. Not only that, its search mechanism has by turns been between
so-so and awful.

Brian
Mar 17 '08 #23

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: David WOO | last post by:
Hi, I am a newbie on C++, I need to define some global variables which should be accessible to most classes. In the mean time, I don't won't the global variables be modified freely at most of...
2
by: Bryan Parkoff | last post by:
….I would like to know which is the best optimization to use global variable or global struct. I always tell C/C++ Compiler to turn on optimization. ….I use underscore between first name and...
10
by: ankisharma | last post by:
Hi all At many places I have seen that programmers pass global variables to functions in c. I am not able to figure out why they do so. need some clues on this. somewhere i heard that this...
1
by: Roy Gourgi | last post by:
Hi, I am new to C#. I am trying to create some variables and arrays that can be seen throughtout the whole program. I have no choice as they have to be seen by the whole program. Where and how...
6
by: calcop | last post by:
Hello everyone, I hope I can write this question clearly. Anyway, it is about global variables. I have several files in my C++ project. One of which is main.cpp. This file comtains my main()...
2
by: robin.bruce | last post by:
Hi guys, I just tried to give advice to a colleague who has a problem program in C, and I was interested to hear the thoughts of this forum on the subject. I've been an occasional programmer...
8
by: yinglcs | last post by:
Hi, I read this article about global variable in c: http://www.phim.unibe.ch/comp_doc/c_manual/C/SYNTAX/glo_int_vars.html But I have a few questions 1. how can I declare the global variable...
2
by: Florian Lindner | last post by:
Hello, I have a little problem with the global statement. def executeSQL(sql, *args): try: import pdb; pdb.set_trace() cursor = db.cursor() # db is <type 'NoneType'>. except: print...
0
by: Gary Herron | last post by:
Jacob Davis wrote: Yuck, YUCK, YUCK! You are breaking *so* many good-programming-practices, I hardly know where to start. First off: A python global is not what you think. There are *no*...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.