Is the file to be text or binary? If it's a binary file, use fwrite...
Cprogramming.com - Tutorials - C File I/O
Kevin
Type: Posts; User: kmess
Is the file to be text or binary? If it's a binary file, use fwrite...
Cprogramming.com - Tutorials - C File I/O
Kevin
fclose needs to be passed the FILE, not a string, e.g.
fclose(infile);
Kevin
Can you please post your program that is causing this error message? It looks like you're using cygwin on Windows. Is this correct?
Kevin
You can find the size of the array and divide it by the size of a char pointer:
#include <stdio.h>
int main( void )
{
char *valid_help_str[] = {
"help",
Any time :)
Indeed, but my comment focused solely on the conditional test expression and the elimination of the break statement proposed earlier, not on the program as a whole.
Kevin
A more straightforward solution that avoids the use of the break statement is to to alter the while statement's conditional test:
i = 0;
while ( i < 10 ) {
scanf( "%i",...
*blush* - I caught it, but evidently not fast enough! I was editing it the same time you were writing about it! :tongue:
Kevin
Glad it helped. :)
That's probably why I'm finding it in my library - I use BSD. Cool to know.
Kevin
Just a few things to get this code to compile:
The main function by definition must return an int. You have defined your function as void, and you fail to return anything at the end of the...
This will compile...
#include <stdio.h>
struct myfile {
FILE *myPtr;
};
int main( int argc, char **argv )
HI Grumpy. I think that bzero() is part of the C99 standard library. It just isn't available in ANSI C. Can anyone confirm?
Kevin
You didn't mention if you want to initialize the arrays several times during program execution, or whether you want to have the arrays initialized one time at the beginning of program execution.
...
fclose() closes the associated file. If function fclose() is not called explicitly, the operating system normally will close the file when program execution terminates. However, if the file is being...
Hi. Since I don't have your configuration, I can't test anything.
Can you print anything to the LCD? For example, can you send the characters in "Hello" and have it display properly?
Second,...
The expression you're referring to is in what's called "infix" notation, and you will need to convert it to "postfix" notation to evaluate it properly.
Check out InFix to PostFix and PostFix...
I guess we have different motivations in helping people. For instance, I like to see that people are making progress toward solving their problems. What's your motivation?
Kevin
Hi intimidator. You are on the right track in that you need to ask the user to input some values. You just need a bit of refinement to get this to first compile, and then to function as you'd like. ...
Any luck, Susu?
Kevin
Oops, sorry, missed your second question... scanf will read all non-whitespace characters and store them into a C string whose address you've passed as an argument. I'm thinking that instead of
...
Your "guess" array is an array of char, into which you're storing an integer value 0 or 1 at element 15. You then attempt to use a switch statement on the characters '0' or '1' (which have ASCII...
While it doesn't answer your primary question, I'm seeing two different serverFunction()s. The first is the prototype,
static void serverFunction(void *t);
and the second is the definition:
...
It's not surprising you can't find any problems in your code - you have absolutely no structure! The compiler doesn't care how your code is formatted, but other programmers do. You'll find you'll...
Sorry, you'll need to get someone who works with Windows to help you beyond this stage. I'm a *nix guy...
Good luck!
Kevin