Programming :: Unsigned Integers In C?
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
ADVERTISEMENT
Dec 30, 2010
Solving issues with signed and unsigned numbers in BASH.For a start, Yes, BASH is type independent � I know that. My problem lays in catching executables output into a BASH variable.My executables are not quite UNIX compatible, where returned values are 0 for OK, >0 ERROR. They return 0 for OK, >0 WARNING (only, so move on) and <0 ERROR (abort) instead.
Code:
// C++ BIN A
int main(){
[code]...
View 4 Replies
View Related
Nov 8, 2010
I have a string, like file223a3b5. How can I extract the number beginning after "file" and ending before "a"?
View 3 Replies
View Related
Aug 23, 2009
Code:
#include <stdio.h>
int main ()
[code]...
View 7 Replies
View Related
Mar 4, 2009
I am aware that this question has been asked before and I have also tried the solution suggested but I am still not able to figure it out why I am getting some wierd results when I am using printf with a 64 bit signed and unsigned integer in C.I am running Suse 10.2 on a Intel(R) Pentium(R) M processor 2 GHz.I tried to call functions strtol strtoll strtoul and strtoull with different integer sizes and these are the results i get from my program shown below:
int i;
char str[100];
char endstr[100];
[code]...
View 6 Replies
View Related
Dec 26, 2010
Im just setting out on the long road to learn python so please excuse my lack of knowledge.Im initally trying to read a csv in and print only certain "elements" (not sure if thats the right term) from a list. But I am getting the error :TypeError: list indices must be integersMy Code is :
Code:
#!/usr/bin/python
import csv
[code]...
View 2 Replies
View Related
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
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
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
Nov 27, 2009
I just installed F12 the other day and I've run into my first problem (this is not a knock, in fact this is probably the best release of Fedora 12 ever for me). Installing Skype from their website. I realise that I'm attempting to install an 1586 binary in x86-64 so it's risky, but that's not the point (yet anyway). I can't even get it to install. I've looked around and can't find anything meaningful on this (other than posts which provided no help). When I try to install the rpm from [URL] with the GUI, I get the message "This action cannot be completed" with the following under details: "The name org.freedesktop.PackageKit was not provided by any .service files". I then tried to install it from a root terminal and got the message, "Package skype-2.1.0.47-fc10.i586.rpm is not signed". Is there a way to change this behavior? And is there a temporary workaround (say, for just this app)? All in all, I love this release, but I cannot recommend Fedora 12 to someone new to Linux without alleviating this issue for them (I'm set to do this tomorrow). This would hamper their efforts to learn how to do basic things, such as installing a random program like Skype.
View 5 Replies
View Related
Jun 8, 2009
How do I install an unsigned RPM, like Cedega, or RPM Wizard?
View 1 Replies
View Related
Mar 13, 2010
You are about to install unsigned packages can compromise your system, as it is impossible to verify if the software came from a trusted source. Are you sure you want to continue installation?YES confirm with password same error, yes confirm with pass same error..
View 2 Replies
View Related
Oct 31, 2010
I am running Ubuntu 10.04.How do I make Synaptic stop giving warning messages about unsigned repositories?
View 2 Replies
View Related
Feb 27, 2010
Every time i load this java application: [URL]
I get this error: "Found unsigned entry in resource"
This application works without problem in windows but give the same error also in leopard...
It is a voip application released by an Ukrainian provider for to call any subscriber through the net for free for a limited number of hours/month.
what way i can make java ignore this problem? To say java i know it is unsigned, but i don't care
View 4 Replies
View Related
Aug 27, 2010
I am interested in learning 3D programming. The thing is, I would hate to put too much effort to learn something that doesn't have future and is dying. My favorite language at the time is Java. My goal is professional programming.
So I have several questions:
1. Should I learn JOGL or start learning C++ and do C++ openGL programming?
2. Is there a big difference between JOGL and C++ openGL programming?
3. Is it worth to learn openGL? Does it have a future?
4. Is it a big difference between openGL and directX coding?
5. If choosing Java, then JOGL or LWJGL?
Why and what is the main difference between them?
View 4 Replies
View Related
Mar 7, 2010
Groovy is an object-oriented programming language for the Java platform. I do not have experience in Java, only perl and shell scripts. Recently I have been asked to maintain a software written in groovy (also to make enhancements). So can I learn groovy without knowing java language. or isit I have to learn java before venturing into groovy.
View 1 Replies
View Related
May 30, 2010
I did searched you tube but my results were not great.I have 2 books on KernelProgramming.I feel I need if some where I can get a video tutorial which can help me to understand how to develop a Linux Device driver that will be great.I had a look at Greg Kroah Hartmans video lecture of developing patches on ......I have been reading books and a lot of stuff.So I wish if I could get a video lecture that would be better
View 1 Replies
View Related
Mar 8, 2011
I have a server listening on incoming client connections. Once the client establishes SSL connection with the server, the server waits on read() from the client. Only Client can disconnect the connection. I want to have a timer in the server program to wait for x secs after read() and then disconnect the Client connection.
View 3 Replies
View Related
Feb 9, 2011
I want that I click with the mouse on the video, it paused.I notice that there is "BaconVideoWidget" which I guess is the video rendering widget but it don't have signal named "clicked":
Code:
vd = totem_object.get_video_widget()
vd.connect("clicked", vd.hide)
[code]....
View 3 Replies
View Related
May 16, 2011
i have a server program which accept multiple client connection and am using polling. like every 2 secs it will look to client whether any data is received after it binded. i have used setitimer but there is runtime error i got.. the server accept all client connection but doesn't execute any msg which client sent.
#include<stdio.h>
#include<stdlib.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netdb.h>
#include<unistd.h>
#include<pthread.h>
#include<string.h>
[Code]....
View 1 Replies
View Related
Oct 27, 2010
I am learning network programming via a book of Richard Stevens.The sample source codes are given here
http://www.unpbook.com/unpv13e.tar.gz
I downloaded and unzipped the file in /usr/src folder.As per the instructions given in README of downloaded archive I did.
View 5 Replies
View Related
Sep 28, 2010
A simple TCP based chat server could allow users to use any TCP client (telnet, for example) to communicate with each other. For this question you should consider a single process, single thread server that can support exactly 2 clients at once, the server simply forwards whatever is sent from one client to the other (in both directions). Your server must not insist on any specific ordering of messages as soon as something is sent from one client it is immediately forwarded to the other client. As soon as either client terminates the connection the server can exit
View 4 Replies
View Related
Dec 19, 2008
I am unable to find a description of alsa's programing language, this sort of stuff:
[Code]...
I need to know what, for example, 'ttable' means and what is its syntax. This seems to be a state secret.
View 2 Replies
View Related
Feb 18, 2011
We have documents on multiple workstations and want to collate them into a single repository to provide text search and download. So far we have implemented rsync to copy files from each workstation under a directory for each workstation on a server (incidentally providing a backup) and have set up text search using Xapian with Omega; users access it via a web browser. Still to do is to set up a system to copy files from each workstation's area on the server to the repository.
Many files are duplicated. In these cases we want to preserve the names but keep a single copy of the file;hard links can be used for that.For each file to be copied from a workstation's area into the collated area we need to check whether it is a duplicate (file size and, if same, MD5 sum) and if so, create a hard link to the original rather than create a copy.A system to detect and replace duplicates in the collated area has been written using ruby and postgresql but the developer cannot commit to continuing this work. It does mean we have a postgresql database populated with "fingerprints" of files in the collated area.My first priority is to get the system working; in the longer term whatever is developed must be maintainable; I do not yet know which language skills are available locally.
I am fluent in bash and competent with awk. Ruby looks nice but I have started to learn python and do think it prudent to learn both at the same time. Python's postgresql capabilities are not settled but may be fine for the simple usage required.What to do? A bash solution would run very slowly but could be developed quickly. Language knowledge aside, I have found it difficult to install ruby on the server (CentOS 5.5;installed rvm but "gem" still not installed; seems a very complex system with its own package management).
View 7 Replies
View Related
May 11, 2011
i have problem in socket programming, while displaying received message in file,i got a problem... i cant able to write it in the file.... this is the code....
Code:
/* tcpserver.c */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
[Code]....
now my problem is run time error i can able to create file but i cant able to write file....log.txt contain nothing.... as here i have give sample code... dont say not initialising function and all.... i have initialised , please only see func1() - my problem is only not able to write msg which i got received from the client..
View 2 Replies
View Related
Apr 11, 2011
I need help as I am not proficient with Linux C++ Programming. There are two parts which I need to do in the coding provided below.
1. Produce the program so it can output the word "Hey there!" and wait two minute and print the word "See you later!".
2. Produce the program that will output the text "Cool" every 20 seconds by setting a periodic task.
Quote:
#include <linux/kernel.h>
#include <linux/module.h>
MODULE_LICENSE("GPL");
int init_module(void)
{
printk("Hey there!
[Code]...
View 3 Replies
View Related