Programming in C.I have two char arrays.char buf1;char buf2;Aren't buf1 and buf2 also pointers?I read in 1024 bytes into buf1 which contain about 300 bytes of characters with newlines. The data is basically a few English sentences. I'm trying to scan buf1 for newlines and then stop at the 1st newline and copy the rest of the data from that 1st newline into buf2.So I run a for loop to look for that new line.
I have an error like this : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''bla..bla..' at line 1. while call my function below:
function InsertSQL(strSQL: AnsiString; CS: TCriticalSection; var ErrMsg: AnsiString): boolean; var td: TDBCfg; SockMySQL: PMySQL; SQL: PChar; begin CS.Acquire; [Code]...
The function always got this error while length of my strSQL contains more than 256 chars.
Program in CSay I have a char array of 1024 bytes called buf1.But I only want to print the chars in index 0 up to index 30. I know I could do this with a for loop. But is there any other way? What about maybe storing from 31-1024 to another char array say buf2 with strcpy and somehow popping 31+ out of the buf1 char array?
I've just updated my linux system (Debian) and went to compile some code I'm working on. However it causes some problems, presumable because of GCC up dates. I get many of my subject line errors for example
../../common/Version_Control.cpp: In function int VersionControl(): ../../common/Version_Control.cpp:55: warning: deprecated conversion from string constant to char*
So I check up the error and it comes from my error handler code which is a function
I need to call a function that takes a string array as argument, declared like this:Code:int someFunction(/* some parameters... */, const char* s);I'd like to know how to allocate memory for the string array. I know a string is an array of chars and an array is a pointer to the first element, then a string array should simply be a two dimensional char array. But is it a single memory block where all strings are stored consecutively?? Or is it a base vector where each element is a pointer to a separate memory block that contains a single string?More specifically: should I malloc() a single memory block large enough for all the strings? or should I allocate separate blocks for each string plus an extra one for the base vector?
I have the following function that does not iterate through the array I want to be able to do some manipulation on each element in the array[@].it appears the below array has only one item in the array whereas i want the array to have 3 items hence the loop three times printing the message Any ideas why this is not happening ?
I want to put a string, such as the one found in the image, into an array that will later be chopped into individual words and put into another array of individual words found in the initial string. (or, perhaps, I would be able to do that initially, but for now, that is the goal)My question is, how can I do that without using quotation marks?
This may be a basic bash array/string operation related question, but I couldn't find any direct answer. So here it goes:I have a lot of data sorted in various directories. All directories need same processing except for a special group of directories. I have a symbolic link of the script in discussion in each directory. I want the script to get the name of the current directory, check if that belongs to special group and do specific operations.So I get the name of the directory
Code: mm=`basename `pwd`` Now the the group of directories that needs something different to be done, contains these
Line 43 points at the snprintf() command.I think the error has to do with the function being virtual and the const after the function definition, however although I have been looking really hard I have not being able to find the reason nor the solution to the problem.
One workaround that I know is moving the block of source withing the virtual function, in the constructor, however having read around (boost library exceptions tutorials) it specifically said that formating of errors messages should not take place withing the construction of objects because we are risking throwing an exceptions and messing up the flow order.