Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If all the lines except the first have the same number of fields on a line then you could parse the first line all by itself and then parse all the remaining lines in a loop.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

If each loop is separated with a space then the loop that uses strtok() isn't going to work they way you have it coded. It might be better to do it like the method you commented out.

If you expect anyone to actually change the code for you then you need to post a few lines of actual data for us to test.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You are running out of stack space most likely.

Lack of stack space won't cause integer overflow problems.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It hailed at my house last year and caused $6,000 damage to my car that was sitting in the driveway and $11,000 damage to the siding and roof on my house. I took a sort video of the hailstorm and posted it on youtube last year.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Oh, that's fairly easy to do, once you realize that there is a maximum of 256 possible characters, of which only about half are printable characters. So, the first thing you want to do is create an array of 256 integers, initialize them all to 0. Then loop through the sentence (or string) and use the character itself as the index into the array. For example the following partial code, after the loop is finished just loop through the array and use the elements whose contents are greater than 0.

int mian()
{
   int array[256] = {0}; // initialize all elements to 0
   char sentence[] = "Hello World";

   // in a loop
      array[sentence[i]]++;
}
deceptikon commented: "mian". :D +12
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I've seen that happen every once in awhile -- when it happens just hit the Flag Bad Post button and ask a mod to delete the duplicate.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Reruns of Dr Who Season 6 on Netflex, I've been watching that show since the first Dr. I think we in USA are one season behind what is shown in UK. We get it on BBC America.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's spring time here -- going to be in the mid-60s (F) today with scattered showers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's not likely the electric meter would even notice the difference.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

unless you have one staring you in the face without a fence :)

<M/> commented: Hahaha :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

static class methods do not have an instance, they are always present in memory just like a normal global function. When you pass a function as a parameter the function is passed by address very similar to arrys and the address must be known at compile time, not runtime. The address of non-static class methods is only known at runtime when an instance of the class is created.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Depends on how you declared the variables. If you used int then you can get twice as much space by declaring either long long or __int64 (compiler dependent). Microsoft compilers recognize long long data type but it is the same size as a long.

Another way is to use a 3d party large number library. There are libraries that let you have an (almost) infinitely large mumber. Or you could, if you have enough experience, write your own large number library.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You mean more electricity to run the computer? No. You can only install a finite amount of ram in any computer. If you are running so many programs that you fill up all the ram then you have lots of other problems too.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

strlen() will tell you hows many characters are in a string. If you are not allowed to use that function then count each character in a loop from the beginning of the string until the null-terminating character 0 is reached.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

you solve it by declaring the variables somewhere. lines 36 to 39 do not declare variables, whose lines are just function prototypes which do nothing except tell the compiler what the function and its parameter types should be.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

and has been for the last five or six years now

It's been a few years longer than that -- I've been a member for over seven years and the newsletter was around when I joined.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

it is not possible to snow where I live.

Never say never. My sister lived in Tustin CA (a little south of LA) for 20+ years and saw it snow once.

Yesterday morning it snows quite a bit here -- all gone by the afternoon.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

they are both wrong,

int x[] is often the same as int* x

void function(int x[])
{

}


int main()
{
    int x[20];
    function(x);

    int* y = malloc(20*sizeof(int));
    function(y);
}
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Did you provide the name of the database. You might want to read Oracle's documentation on that command to see if there are other requirements.

DROP DATABASE <database name>

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

DROP DATABASE will delete them all and the database.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Yea, you are right. When I tried it I mis-read the error message, thinking it said "command not found". That's what I get for not reading more carefully.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

xcopy is an old old MS-DOS command, not implemented on MS-Windows 7/8 (don't know about previous versions of MS-Windows).

You might consider win32 api function SHFileOperations or the simpler to use and understand CopyFile along with FindFirstFile and FindNextFile to get the list of folders and files to be copied.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

standard sql DROP TABLE <tablename>. You may have to drop indices first. DROP INDEX index_name

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Where did you get that structure? What compiler did your teacher use to write that file (the size of an int is not consistent across all compilers.)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I compiled it with Visual Studio 2012 and got these unresolved externals, which means you have not implemented some of the functions in that template.

1>SpellCheckMain.obj : error LNK2019: unresolved external symbol "public: __thiscall DoubleLinked<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::DoubleLinked<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??0?$DoubleLinked@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@XZ) referenced in function _main
1>SpellCheckMain.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall DoubleLinked<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::~DoubleLinked<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??1?$DoubleLinked@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@UAE@XZ) referenced in function _main
1>SpellCheckMain.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall DoubleLinked<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::add(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (?add@?$DoubleLinked@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
1>SpellCheckMain.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall DoubleLinked<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::contains(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?contains@?$DoubleLinked@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@UBE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
1>C:\dvlp\ConsoleApplication3\Debug\ConsoleApplication3.exe : fatal error LNK1120: 4 unresolved externals

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Need BagInterface.h

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Post both header files so that we can try to compile it. If they are pretty big you might want to zip them up and attach them to your post.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I too have a bad memory for people's names and faces -- I don't remember a new person's name for more than a few seconds. One guy was very pissed off because I couldn't recall his name. But oh well, that's his problem not mine.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Ok children, stop the bickering :)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

string has not been defined. You need to include <string> header file. Some compilers do that for you while others do not, so it's best to just get into the habit of always including <string> if you use it.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

My happiness has definitely increased significantly since I quit smoking 13 years ago. (I'm thinking of the board game called "Careers" where you gain hapiness and fame points.) My fame points were not affected, but my happiness points sure were.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

but i couldnt find a SQL section.

It's under Web Development --> Databases. But here is ok too.

What database server will you be using? I doubt MS Access can handle that much information to rapidly. Can you consider redesigning the project? For example, the program could hold the data for one minute, summarize it, then send summarized data to the database. How userul will that much raw data be to anyone? Will summaried data be just as usful?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I have no bad habits because I'm perfect in every way.

<M/> commented: Right... ;) +0
harinath_2007 commented: good joke :) +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Be sure to post new code. I'm not showing you all the errors in your program. You should be able to find the rest by using the examples that I did show you. Compile the program, look at the first error message, fix it, then compile again. Fixing one error will likely resolve several error messages.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

granted, the whole world is now in a state of anarchy.

I wish I could eat all the ice cream I wanted without gaining an ounce.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

please post the code that writes the file.

line 18: why is the loop hardcoded with that magic number instead of using the int that was previously read?

for(counter = 0; counter < no_of_readings; counter++)

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

I thought I already answered your question. If you are passing an array of structures you don't need the & operator, just the name of the array because arrays are always passed as pointers. If you are passing a single structure then you need the & operator to make a pointer.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Nevermind, they are gone now.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Two article titles here are still in the list.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

It's true we all die of something one day, but why hurry it?

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

lines 69, 71, 79, 87 and 88: remove & from the parameters -- they are already arrays. When passing an array all you do is enter the name of the array, adding & operator makes it a pointer to the array (like wait**), which is not what you want.

line 81: scanf() needs a pointer to the variable where it is to store the data. So on this line you need the & to make ep a pointer, since all it is is a char.

line 104: wait->Front makes no sense because want is an array. Which element of wait do you mean? wait->Front is the same as wait[0].Front

line 107: I've already shown you how to fix that and other similar lines.

line 108: Same comment as for line 104 above.

anestistsoukalis commented: thanks +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

The way I organize a program is something like this

  1. All header files
  2. structures and other defines
  3. function prototypes
  4. actual functions

It doesn't really matter in which order the functions appear in the *.c file(s) when you provide function prototypes. If your program consists of two or more *.c files then you will probably want to put the function prototypes in a header file and include that header file in each of the *.c files.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Doesn't the program you posted do it? Although both cases are identical.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

There 12 errors that I cant solve it....

Post the errors, we are not mind readers.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

.i think you can do it with turbo c or turbo c++ .

Yes, the posted program will work if compiled with a 32-bit compiler, not sure if it will with Turbo C or not because Turbo C may not be able to "see" the c:\windows folder since it doesn't know anything about NTFS file system or long file names.

I thought you were asking how to shut down MS-Windows os. If that was not your intent then maybe you should have posted this as a Code Snippet which is something to show us how to do something instead of asking a question.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

Unlike C++, C language requires the data type on line 27, the symbol app by itself is not a data type. It should be struct app applist[2];

wait[] is an array of structures, not an array of pointers to structures. So you need to use the . operator instead of -> operator, something like this:

printf("%s , %d , %s",wait[Front].name,wait[Front].choice,wait[Front].phone)

anestistsoukalis commented: any ideas for the errors ? Thanks for struct and the operaton thing. +0
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You need to start learning to organize your programs so that they contain functions that perform specific tasks. For example wrire a function that does nothing more (or less) than adding a node to the linked list. When you get that coded and working correctly move on to write another function that moves a node from one position to another. You can write separate functions for each of the 5 requirements that you listed.

line 15: You need to define the return type of main(). That is a somewhat special function in that the value returned by main() is captures by the operating system. You should ALWAYS declare main() like this: int main() or like this:int main(int argc, char* argv[]); Anything else is technically not acceptable and unportable, although some compilers let you declare void main()

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

line 14: It looks like INPUT_BUFFER is a macro defined to be some number. sizeof(INPUT_BUFFER) in that case will be 4 because sizeof(<any integer>) is 4 on a 32-bit compiler (that may not be true for all compilers, but it is true for all the most common ones). Just remove use of sizeof from that line

line 15 is not making a copy of anything -- use strcpy() to make a copy of the string, the assignment operator = will not do that. Line 15 should read this strcpy(cpPassedString,passedString);

line 21: You are attempting to store a temp pointer into an array which will get destroyed when the array is returned on line 26. All the pointers that the array contains will become immediately invalid because tempArray does not own the data. On line 21 you need to allocate memory for and copy the strings using strcpy instead of just assigning the pointers. One easy quick way to do that is call strdup() like this: tempArray[counter] = strdup(tempString);

line 26: you need to free() the memory allocated on line 14.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

which version of Borland compiler? You would have to have a 32-bit version in order to access the win32 api functions. Can't do that with Turbo C or Turbo C++. Here are the functions you will need.

Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster

You normally can not use the same serial port to communicate with multiple devices, each motor would have to be on a different serial port. If each motor is only going to use a couple pins from the serial cabel then you could put a splitter in line to redirect the signals to both motors, but that might be an unusual situation. Your program could have a separate thread for each serial port.