Programming :: MySQL Unsigned Character?
Jan 8, 2010
I am trying to create a table T having a field F which should be able to store variable-length sequences of "unsigned" characters (8bit values ranging from 0 to 255 (not including 0, including 255)).(MAX_LENGTH) is not working, as it seems to want sequences of 8bit values ranging from 0 to 127 (thus "signed" characters).Can anyone help me by pointing out if there is a type suited for my needs (or if such a type does not exist)?For those familiar to C programming and working with the MySQL client library, I should be able to (successfully) do something along the lines of:
Code:
unsigned char value[] = { 'H', 'E', 'L', 'L', 'O', -1, -128, 'W', 'O', 'R', 'L', 'D' };
unsigned char query[255];
[code]....
View 3 Replies
ADVERTISEMENT
Mar 24, 2009
From what I understand, if I attempt to increment an unsigned int which is already at its max value, it will flip back to zero.Question: is this guaranteed to happen by the C language? That is, can I count on this happening on all platforms?(Of course, I recognize that the max value of the int will change from platform to platform...)
View 5 Replies
View Related
Oct 17, 2010
I am a dummy in C programming. I have a problem with copying the array of 64 elements of unsigned char to array of 8 element of uint64_t. For example:
unsigned char p[64]
uint64_t Data[8];
memcpy (&Data, &p, 64);
I am not sure if it is right. Please help me. Thanks a lot.Moreover, do both p and Data have 64 bytes?
View 2 Replies
View Related
Feb 20, 2011
I'm writing a tridiagonal solver for sparse linear systems and I coded this decreasing loop:
PHP Code:
xx[NN - 1] = gamma[NN - 1]*BB[NN - 1];
ii = NN - 2;
/* Compute the x values: */
while (ii >= 0) {
xx[ii] = gamma[ii]*(BB[ii] + xx[ii + 1]);
ii = ii - 1;
}
now... if ii is declared as an unsigned integer, the code gives me a segmentation fault, but if I declare it as an int, it doesn't. Using DDD I noticed that, as an unsigned int variable, when I finally decrease it, it underflows and blows up to a huge value, ergo giving me an unaccesible direction for xx in the following iteration! I taugh me not to use unsigned int variables for dereasing loops! XD
View 14 Replies
View Related
Jul 21, 2011
I copied and test a simple random number generate program
#include <algorithm>
#include <vector>
#include <iterator>
#include <iostream>
[code]....
View 2 Replies
View Related
Apr 7, 2010
I am accessing a firewire camera using the libdc1394 library and saving the image as a PPM file, using the code below:
[Code].....
My question is whether the above code is portable. I presume it is, since the result is a binary PPM file which should be capable of being read across multiple computers with different architectures and different operating systems. But at the same time, all that the above code is doing is just saving the binary representation of unsigned chars on the harddrive, and there does not seem to be any reason why the binary representations of the unsigned chars will be identical across multiple computers.
View 1 Replies
View Related
Mar 27, 2010
1.What character instructd the shell to interpret a special character as an ordinary character?
2.What directory contains some of the utilities available on the system in the form of binary files?
3. What command is used to search the location of a utility?
4. What command is used to instruct the editor to write the file and quit the editor?
5. What key quits the more utility and displays the shell prompt?
6. What command starts a child shell as the super user, taking on root's identity and environment?
7. Which wildcard characters can be used for searching all the files in the system that start with "A"?
8. The user name or login name of the super user is????
[Code]....
View 10 Replies
View Related
Feb 27, 2009
I have two systems at hand. One a Debian box, the other a RHEL5 box. On the Debian box there is a MySQL server (5.0.32-Debian_7etch1) running which hosts Databases from a customized content management system. This system has grown over time and the tables are stored with different collations. Now I want to export and reimport the data on the RHEL5 MysQL server (5.0.45).
And here the special character hell begins. It doesn't matter if I reimport the data as utf8, as latin1 or latin1_swedish_ci. Everytime the special characters are wrong and distorted. Surprisingly the data that is shipped with the unmodified CMS displays the special chars correctly after installation. But I have to import the modified version from the old server as there are lots of modifications to import.
Old server:
Quote:
character set client utf8
(Global value) latin1
character set connection utf8
[code]....
New server:
Quote:
character set client utf8
(Global value) latin1
character set connection utf8
[code]....
View 1 Replies
View Related
Feb 14, 2011
i define variable of type char (range -128 to 127). when i tried to print the value after assigning a -ve value to it it displaying a +ve value of that -ve value(256+value).
View 3 Replies
View Related
Mar 4, 2010
is it possible to convert a variable from char * to unsigned char ?
View 5 Replies
View Related
Jun 27, 2010
I have a string like this "/home/test/filename.txt" and i want to delete all character after the last "/". how to do that using sed or awk.
View 5 Replies
View Related
Nov 3, 2010
I was reading Kernighan Ritchie book chapter 4 which deals with character pointers.I am not able to understand following different type of declarations
Code:
char aname[][15] = { "Illegal month", "Jan", "Feb", "Mar" };
char amessage[] = "now is the time";
[code]...
View 1 Replies
View Related
Oct 23, 2010
i am compiling the following program in linux. it's in c language. after the compilation with gcc when i run the executable file. it asks for input. but when i enter a name. i prints "Segmentation fault" and then terminate the program. can you please help me.
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
[code]....
View 1 Replies
View Related
Feb 24, 2010
which is the simplest way to have first and last character cropped out from a string? Something simpler than
Code:
echo $STRING | cut -b 2- | rev | cut -b 2- | rev
View 6 Replies
View Related
Mar 30, 2010
I have the following file:
Code:
1 line
...
49 test test=AA:AA:AA:AA:AA=0
I need to substitute on the line number 49, all text until =. I have used the following, but with no actual result.
sed -re '49s/^.+=//' file
and
sed -e '49s/.*[=]//' file
View 5 Replies
View Related
May 11, 2011
I have a file with one line. I want to check whether the first character is TAB or space, how can i do this.? using "cut" wont as it "bypasses the tab and space characters"
View 3 Replies
View Related
Apr 22, 2011
I am trying to check if the 9th character in a file on each line is a v and if so, then print the first word. I've tried a number of variations and am stuck !If it's possible to also check if character position 1 begins with a s in the same awk, that would make it cleaner instead of using egrep.
egrep '^s' file | nawk '{virtual=substr($0,9,1); if ($virtual=="v") {printf "%s", $1}}'
nawk: illegal field $(e)
input record number 1
source line number 1
View 13 Replies
View Related
Aug 2, 2010
I believe I have unwanted ' characters left in a 9 element character array that are causing subsequent operations with it to fail. I see wildly differing views on the web on the proper way to flush 'em. It's clearly not as simple as it would appear at first sight. What's currently the best (or else "least deprecated") method?
View 5 Replies
View Related
Feb 12, 2010
I am loading variables for cXtXdXsX disk names into a script, and at present I have only accounted for there being 3 characters from c to t. I need to change it to a variable recognition so that it can count any number of charcters such as c1t , c10t , or c100t.
I can then take that information and use it with the following string to strip off the lead characters so as to make the 3 in $substr either a variable or redirect to multiple occurrences of raw based on the count returned.
sub raw {
$substr = substr ($_, 3);
$raw1 = substr ($substr, 0, -4);
$raw = lc($raw1);
}
how to count from the c to the t inclusive so I get 3, 4, 5, etc ...
View 9 Replies
View Related
Jan 19, 2011
how to replace last character string. For example
$>export T1=abcde
$>export T2=xyz
how to get result abcdxyz?
View 10 Replies
View Related
Jul 25, 2011
I have a string as below
LogFormat "%h %l %u %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
Want the above string to be modified as
LogFormat "%h %l %u %D %t "%r" %>s %b "%{Referer}i" "%{User-Agent}i"" combined
inserting %D after %u in the string
View 3 Replies
View Related
Jun 22, 2010
i have the following:
Quote:
echo %host%|sed "$s/.$//"
this would remove the Last character of the value assigned to the %host%. for example if my value is: abcd i get abc. but i am not able to assign the output. for example when i do
Quote:
set k=`echo %host%|sed "$s/.$//"`
after doing echo %k i get no output at the command prompt...!! whereas when i just type:
Quote:
echo abcd|sed "$s/.$//"
at the command prompt i get abc. maybe some other ways to Remove the Last character...?
View 13 Replies
View Related
Apr 7, 2011
I have the following string:"My dog spot(page 1)". I want just "My dog spot". How do I do this in SQL Server?
View 2 Replies
View Related
Mar 31, 2010
I've a problem with character device mounting. I've a character device module code. Here is the code
Code: /* chardev.c: Creates a read-only char device that says how many times
* you've read from the dev file
*/
#if defined(CONFIG_MODVERSIONS) && ! defined(MODVERSIONS)
#include <linux/modversions.h>
#define MODVERSIONS
[Code]...
View 1 Replies
View Related
Jul 12, 2010
i was trying to access the address of the character pointer it gives me the values stored in the variable.
Code: #include<iostream>
using namespace std;
int main()
{
char *i;
[Code]....
why is my code not giving the address of the variable i when it is a character pointer.
View 2 Replies
View Related
Jun 23, 2011
Im trying to read a file in c++ and search for particular character for example if this is a list that I have:
Alice
Bob
David
[code]....
if the input is D, it should give David, if its B, gives bob. so in this case, meaning it reads the first character of every line. but if possible I want to make this dynamic so the user can specify which character position he is looking for, so in case he is looking for R as character index 3 in all lines, it should give Charlie. but the problem is, it does now recognize , besides, I do not know how to specify the character position in each line.
here is my code
Code:
#include <iostream>
#include <fstream>
#include <cstring>
[code]....
View 1 Replies
View Related
Jun 25, 2010
I have the following command that greps "/etc/cron.allow" and displays the following 9 lines of $file grep -A 9 "/etc/cron.allow" $file On the other hand I would like to grep a file for a certain text display the next couple of lines and stop when i hit a specified word or blank or pattern.Basically I would like my grep to end when the shell hits a blank, certain key word or pattern specified in command.
View 7 Replies
View Related
Aug 18, 2010
i have problem in java. how to convert string array to character. e.g string a[]={"ab","abc","abd","ag"}; what will be the character array ?
View 3 Replies
View Related
May 15, 2010
As you know, in C++ you can use setfill(char c); and setwidth( int length) to fill a line of a character.
It's line making a line of a character for output
Code:
NAME DEPARTMENT LOCATION
==========================================
Pete R&D Chicago
...
==========================================
As you see, a line of a '=' character drawn to output.
I'm wondering, how can I draw this line in C using printf() to format?
( no loop or repetiton )
View 8 Replies
View Related
Jun 15, 2011
I need some software that will check .xml file and tell me which character is malformed in 'utf-8'. I am using perl for some parsing.
View 2 Replies
View Related