...a single field to represent multiple values, you could make the field one of the unsigned types, assign each value a bit and go from there.
e.g.
/* A represents bit 1, H represents bit 8 */
enum values { A,B,C,D,E,F,G,H };
struct person {
unsigned score;
...
};
Then, some macros for...
Not sure what you're asking exactly, but strcmp() returns 0 when its string are equal and a non-zero value when they are not. So given two strings, s1 and s2:
if (strcmp(s1,s2)==0)
puts("equal");
else if (strcmp(s1,s2)>0)
puts("s1 greater than s2");
else...
...sentences :-)
Consider the standard function atexit() which is used to register functions to be called at program termination:
int atexit (void (* function)(void));
It accepts a pointer to a function that accepts no parameters and returns void. To use it, you would define one or more...
...as well, though it emits a diagnostic telling me that main() returns int. The only portable definition for main() is either:
int main(void) { /* .. * / }
OR
int main(int argc,char **argv) { /* ... */ }
As a result, any conforming C compiler is allowed to reject any C program that does not...
Another variation on the seek method described above is to use mmap() (if it's available to you), which allows you to treat the contents of the file as an ordinary array of char. This might be easier and will probably be faster.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
...it, but it has at least one problem. Don't test for feof() at the top of your loop like that. feof() doesn't evaluate the stream it's passed. As a result, your fgets() call below it will return NULL when *it* encounters end-of-file.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
...scanf("%s",ptr->name);
scanf("%d", &ptr->identity);
4. In initial_screen() you have a statement with no effect:
("\n\t*************************************************\n");
5. In main() you pass print_details() an incompatible type. Change it to this...
That's not strictly true. An array doesn't become a pointer to its first element when it is the operand of the sizeof operator or the operand of the address operator. This is why (where a is an array and p is a pointer to the same type) sizeof(a)!=sizeof(p) and &a becomes a pointer to an array...
I don't think this is possible. The only way I'm aware of is to write the DLL in C and then call the functions exported by the DLL from VB (with the appropriate Declares).
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
For memory leaks, see:
http://www.dmalloc.com
For profiling, see if you have gprof or prof (comes with the GCC compiler system).
There are many others, try a web search.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
Actually, sizeof(char) is guaranteed to be 1, so multiplying by sizeof(char) buys you nothing.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
Clearly, your program is doing something illegal, but we can only speculate on what it's doing in the absence of the source code.
Try posting a *small* compilable program that exhibits the problem.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
You'll want to change that loop to check for EOF, in case the user signals EOF before pressing Enter:
int gobble_stdin(void)
{
int c;
while ((c=getchar())!='\n' && c!=EOF)
;
}
In C, there isn't any defined behavior when fflush() is used on input streams. However, implementations...
The program looks fine. When you're running it inside VC++, are you sure you're entering the input in the IDE in exactly the same way you are when running it outside the IDE?
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
How you do this depends on the format that your dictionary is stored in. First, you'll need a dictionary. Check this out:
http://www.helsinki.fi/~hkantola/dict.html
Also, this is the C forum. Since you plan to do this in C++, you should post to one of the C++ forums.
Russ...
Repost your code and this time uncheck "Process TGML". What's happening is your indices are being treated as commands to display the text in italics.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
A few others to try:
Cygwin (UNIX emulator for Win32 with GCC):
http://www.cygwin.com
LCC-Win32:
http://www.cs.virginia.edu/~lcc-win32/
DJGPP:
http://www.delorie.com/djgpp/
Borland C++ (also a C compiler):
http://www.borland.com/bcppbuilder/freecompiler/
For editors:
VIM (free)...
You can write DLLs in C and call the exported routines from a VB program. You can't compile C programs using VB, though, as far as I know.
Russ
bobbitts@hotmail.com
http://home.earthlink.net/~bobbitts
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.