printf("Hello\n\nHow are you?\n");'\n' is the newline character.
Type: Posts; User: 00Sven
printf("Hello\n\nHow are you?\n");'\n' is the newline character.
if (matchsticks == )
matchsticks=4;
else if (matchsticks;
What is this supposed to be?
Dev-C++
When you compile C code in Dev-C++ the file extension must be .c. The default is .cpp so you need to change it. If you leave it as .cpp it will compile as C++. This works most of the time but some...
Get each line one at a time and then use something like strlen() to find the end and go from there.
That is how you do it. Make it an array of structures and then that works. Maybe I dont understand the question?
~Sven
You can use an array of structures instead of a bunch of structures. Instead of having:
typedef struct TOTAL_REGS_tag
{
REG_TYPE_T SM0;
REG_TYPE_T SM1;
...
What about square root or exponents? In math.h there is a sqrt() function for getting the square root and you can use a loop to do exponents.
main() returns an integer.
int main(void)
You...
LINKDon't double post.
~Sven
I will explain. %d is a conversion character for printf. It holds the place for a variable which you put in at the end. For example, to print out the value of the variable num, the code would be ...
Just print the information into a file and then when they open the program again read the information from the file.
~Sven
It is a lot easier if you post your C source code in .c
~Sven
Open the file. With a while loop.
while(fgetc(file) != EOF)
{
count++;
}~Sven
Never use gets. LINK Replace it with fgets. LINK
Just an idea but I am not sure if this is what you need. If it will always be the same locations you can use a structure.
struct location{
...
You need to add the -1 after strlen(buffer). Arrays start at 0 and not one. Buffer[strlen(buffer)] is out of bounds.
~Sven
You can always also just do
filename[strlen(filename)-1] = '\0'This takes the number of characters in the string and then subtracts one (because arrays start at 0 and not 1) and if the string was...
strchr is a function for splitting up a string. It takes a string and a character to look for. When it finds thie character it returns a pointer to that first part of the string. If it does not...
There are quite a few errors her so bear with me.
Never use gets. LINK Replace it with fgets. LINK
What is this??? What is gets supposed to be? I think that you want to check the string...
What is wrong with the stat function?
~Sven
I found a better solution, take sleep out of the program. It was pretty pointless in how it was used so now it is gone.
~Sven
int ch;
char array[10];
FILE *in;
in = fopen("temp.tmp", "r");
if(in == NULL)
{
printf("Error opening file!\n");
}
while( (ch = getc(in)) != EOF)
{
Make another array and then just go to the beginnning of the linked list and put the string into the array with sprintf. Next loop through the list using strcat to add each string to the end.
~Sven
I thought that I had corrected that but I must have forgotten to. You are right response should be an int not a char.
~Sven
I do not refer to the return value of getchar. I simply use it to pause the program. You could take this out of the program but then as soon as they hit y or n it would do the code for that choice...
You can use getch it will still have them enter whatever they want. It will only display the character if they enter a y or n. It is pretty complicated though.
char response;
printf("Continue?...