Programming :: How Does Cin Work?

Mar 1, 2010

This code will execute fairly well, however, if you enter multiple values that are not A/a or b, 1 or 2, then when the program resets, cin does not behave normally. Instead of waiting for input, it acts as if it has already been given input, and the input is the next character from the one entered.For example, entering "345" and submitting it at the (cin >> a line will individually pass the values 3, 4, and 5 through the if/else and switch statements, rather than only inputting the first value, 3, or all the values, 345.

If you enter, for example, "3343634563456345", then it will pass through the do{}while(); loop 16 times, with each pass having a = to the next character value. The cin >> a; is performed, and this is verifiable in GDB, however it never asks for input from stdin, and instead gets its input from somewhere else. How can I observe that, and what is going on?Furthermore, if you enter "cdefghijklmnopqrstuvwxyzab", it will pass through 25 times, and stop at a, which goes through the switch, and ends at a case statement that does not adjust the false value of mreset, thereby allowing the program to end.

View 10 Replies


ADVERTISEMENT

Programming :: How Does The Assert() Work

May 22, 2010

I got a problem about assert() on linux/unix && gcc , I wanna know how does assert() work,I mean that how does the assert() make the programme exit? Is assert() send SIGSEGV to programme or called function exit() or other ways?

View 4 Replies View Related

Programming :: Cc And Gcc Compilers Don't Work

Nov 14, 2010

I've tried instralling the c and c++ compilers on my fedora 13 machine and none of them seem to work. For example. i have this extremely simple c program that i try to compile and nothing works.

Code:

#include "stdio.h"
printf("Hello World"); when i type Code: [####localhost Desktop]# cc hello.c i get this error Code: hello.c:3: error: expected declaration specifiers or �...� before string constant
hello.c:3: warning: data definition has no type or storage class

[code]...

i've tried intalling a group of developers tools using yum groupinstall "Developers Tools" and nothing......

View 3 Replies View Related

Programming :: Use The Seq Command But Can't Get It To Work?

Mar 24, 2011

I have a script that will build a list of hosts and it works fine Code: for ((i=$START; i<=$END; i++)); do echo "$NAME$i"; done But I need it to build the START and END on different number formats (i.e. 1 -> 10, 01->10, 001 ->010)

I am trying to use the seq command but can't get it to work quite right with the -w flag in the following Code: for ((myseq=$START; myseq<=$END; myseq ++)) do echo "$NAME${myseq}" done I am fully aware that this syntax is probably wrong, and need to know how to correct it.

View 1 Replies View Related

Programming :: Can't Get The OR Operator To Work?

Apr 18, 2011

I'm having a bit of trouble getting the OR operator to work.This is the code that I have:

global.php:
Code:
$vars["admin link"] = "<a href='/path/to/admin.php'>Admin</a>";
$vars["admin ip"] = "xxx.xxx.xxx.xx1";
$vars["admin ip2"] = "xxx.xxx.xxx.xx2";

[Code]...

View 7 Replies View Related

Programming :: Cc And Gcc Commands Don't Work

Nov 14, 2010

I've tried instralling the c and c++ compilers on my fedora 13 machine and none of them seem to work. For example. i have this extremely simple c program that i try to compile and nothing works.

Code:
#include "stdio.h"
printf("Hello World");

[Code]....

View 6 Replies View Related

Programming :: How Do Cookies Work?

Mar 31, 2010

I understand that a website can set a cookie which means a little text file with a no. in it will be created on the client side, and then the no. will get sent to the server with every visit. But how is this used to customize a page? Does this mean that a MySQL database *has* to be created, which can be used to match up that no. with a particular login name, for instance? How exactly is this pulled off?

View 3 Replies View Related

Programming :: How Does E-commerce Work

Apr 16, 2010

I understand that cookies are used to hold the information of what items has been added to a users shopping cart on the server side. But then what happens when the user clicks "Buy" - how is the data from the server (i.e. the amount) transferred to the payment mechanism, which is probably a third party like WorldPay or something?

View 7 Replies View Related

Programming :: Multithreaded App Using Pth Does Not Work?

Mar 4, 2010

I threw this togher based on the examples but the thread does not seem to run:

Code:
#include <stdio.h>
#include <pth.h>

[code]...

View 3 Replies View Related

Programming :: Get Qt Plugins To Work?

Mar 21, 2011

I've tried many times to get Qt plugins to work, but I just couldn't figure it out. I've written a small test application, how to write a plugin for it?

View 14 Replies View Related

Software :: Work In Terminal And C Programming?

May 10, 2010

I am having one Laptop. In that i am facing some error while installing linux OS. so i planned to install only terminal in my laptop. i dont want any gnome and etc.. simply i am going to use only c programming in my terminal. gcc compiler and shell to work "c" is enough for me. How to work in terminal and c programming.

View 6 Replies View Related

Programming :: How Break Points Work In GDB

Mar 24, 2011

I want to know that how the break points and watch points work in the GDB. I know the GDB works on symbol table. But would like to know more details of it. How watch points differ from break points.

View 3 Replies View Related

Programming :: Can't Get HTML Canvas To Work In IE?

Jan 1, 2011

Does anyone know how to get HTML5 canvas to work in Internet Explorer? I tries to do it using excanvas and jqcanvas but had trouble using them.

View 11 Replies View Related

Programming :: Cut Command Wont Work?

Mar 3, 2010

on linux command promt cut command work.but the same command gives empty output in linus shell?F1=$(echo $line | cut -s -f26) NOT working in shellcat file | cut -s -f26 work!

View 3 Replies View Related

Programming :: Getting A INIT Script To Work?

Feb 23, 2011

This is my first init script, so far, it atleast starts the daemon but it fails at creating a pid, so later on I can use to, to either stop it or reload it. Here's the current code: Further more, the script returns ok that it started the pid, when in fact, the pid fails in the background, this script needs MUCH improvement, some help would be nice to fix this script. :/

Code:
#! /bin/sh
### BEGIN INIT INFO
# Provides: znc
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6

[Code]...

View 2 Replies View Related

Programming :: One-liner With && And || Didn't Work

Feb 9, 2011

I recently noticed some of my one-liners with && and || didn't work as I expected so I googled for "bash && || pitfalls" and found this page [URL] It's probably my fault, but I still don't understand why it wouldn't work as I want it..... I don't even have the code anymore that wasn't working properly because I rewrote it using if ; then ; command ; fi

View 4 Replies View Related

Programming :: Following Code Compiles, But Does Not Work?

Nov 8, 2010

Put simply, the following code compiles, but does not work, and I have no clue why (despite reading extensively about rand()). In the interest of full disclosure, this is for a school project.

Code:
/*
* Dice.c

[code]....

View 4 Replies View Related

Programming :: Getting A Comparison Operator To Work?

Feb 8, 2010

I'm very new at Bash scripting and have a bone head issue that I'm trying (and failing) to resolve. I cannot get this one IF statement to work, it seems the comparison operator does not think the resulting number from the $b*$c+$b operation is an integer even though it is a number. Below is a small proof of concept script with the bit I'm having trouble with.

Code:
#! /bin/bash
a=800
b=700
c=.15
if [ "$a" -le "$(echo "($b*$c+$b)"|bc)" ]

[Code]...

View 6 Replies View Related

Programming :: File Redirection Does Not Work Bizzare?

Apr 21, 2011

When I execute the following command from the linux command line I get the output I want to the screen

[Code]...

View 1 Replies View Related

Programming :: Get A Variable To Work As The Index Of An Array?

May 3, 2010

I am having a little trouble with a Bash shell script that I am working on. It is intended to read the information out of a gedcom genealogy file and determine who has lived in a particular area and output a report based upon who lived in a given area (like the different sections of a bygdebok for example). I am having a number of issues.

1) I can't seem to figure out how to get a variable to work as the index of an array. For example, I am trying to use the variable $individual to count which individual is being read in from the .ged file, and once that is figured out, next I will read in the individual's name, so I would like to create an array of names using the variable

Code:
$individual
as the index of the array. However, if I try the code
Code:
name[$individual]=$lineoftext;

[Code]....

I included only the last few lines of output as to not take up too much space because the output goes on forever, but you get the point from the example. This output has nothing to do with what the final output of the program is intended to be like. It is merely a test to prove that the 2 variables in question are getting their date loaded in properly.

View 14 Replies View Related

Programming :: Regular Expression {x} Doesn't Work?

Sep 2, 2010

I am trying myself on regular expressions. A read on [URL]/regex.htm) that {x} means search X times preceding character. So, why is this :

Code:
wstation~> echo '123456789' | grep [0-9][0-9][0-9]
123456789 # MATCH !! I have 3 numbers in a row.

[code]...

View 2 Replies View Related

Programming :: Alias And Shopt Won't Work In Script

Jul 6, 2011

alias and shopt won't work in script

[Code]....

View 9 Replies View Related

Programming :: Bash - Renaming Files Won't Work

Apr 1, 2010

I'm trying to rename a lot of files getting rid of the space on the names. For that purpose I wrote this very simple bash script, but for some reason is not working.

Code:
for i in "$(ls)"
do
j=$(echo "$i" | sed 's/ /_/g')
mv "$i" "$j"

done But what I get in return for each line is just one long file name with all the file names concatenated. I've tried with echo -e "$i" as well with no results. This has to be something really simple that I'm missing but I just can't see it.

View 11 Replies View Related

Programming :: Code Committed In Repository Does Not Work (Next Day)

Jan 3, 2011

It has happened with me before too! Few months back while working on Priority queue in C language, I successfully compiled the code and it gave the desired outputs, I showed the running code to my other seniors and committed it to the repository at 21:00 (I was in the office till late night), next day my boss asked to show the running code, and it didn't work!!! I updated from the repository whatever I had committed but still nothing worked? And then on this Saturday, my boss fixed a bug and committed to the repository and asked me to checkout which I did today morning, and when I ran the code it didn't work?

View 7 Replies View Related

Programming :: Control/Meta Keys - How Do They Work?

Mar 28, 2011

I would like in depth knowledge of how these keys work. If I were to want to use these keys for my own application how would I program them?

View 1 Replies View Related

Programming :: Get A Void Pointer Cast To Work?

Sep 29, 2010

I have been trying to get a void pointer cast to work and I seem to have some problems. My code compiles, but when I execute it gives back garbage data. I'm not sure what I'm doing wrong.

Code:
int main()
{

[code]....

View 7 Replies View Related

Programming :: Imagemagick With For Loop On The Commandline Does Not Work

May 26, 2011

I have images in jpg format

Code:

CIMG0100.jpg
...
...
CIMG0131.jpg

I used imagemagick to convert the files to gif with the following command

Code:

for i in {100..131}; do convert CIMG0$i.jpg CIMG0$i.gif; done # works

This worked like expected, but when afterwards I wanted to scale the images

Code:

for i in {100..131}; do convert -scale 25% CIMG00$i.gif CIMG00$i_scaled.gif; done # works not it seems the system is working for about half a minute, but I get no output. The single command

Code:

convert -scale 25% CIMG100.gif CIMG100_scaled.gif # works

works as expected and gives me a scaled image. What does the convert command do in the second case? is the for-loop wrong?

View 2 Replies View Related

Programming :: PHP Serial Port No Longer Work

Aug 24, 2010

I had a web server running from a Windows 7 computer and recently moved everything to an Ubuntu server. All is set up and running smoothly. I do have one page that actually interfaces with the serial port. The only thing I do with it is to set the DTR pin to "true" which applies +12v to the pin. This activates a relay. It is very basic and simple. After moving everything to Linux, this page will no longer work. I knew this would happen. I know the page had code in it to call out "Com1" which would change to "ttyS0". It also had "set_serDTR(True);" in the code. I can't figure out how to get PHP to control the DTR pin on a Linux serial port.

View 10 Replies View Related

Programming :: Make Recursive Makefile Work?

Jun 8, 2011

I'm trying to make recursive makefile work but it's giving me two problems. I have a top folder with the main Makefile and one Makefile for each sub folder 'one' and 'two'. Makefile in subfolder 'one' and 'two' are identical. The top Makefile (still a bit messy) looking like this:

Code:
# Directories
CC = gcc
CFLAGS = -Wall -Wextra
TARGET_DIR = bin
MAIN_FILE = one.c

[Code]...

View 4 Replies View Related

Programming :: App To Deal - Work With Requirements Management?

Jan 15, 2010

What is the application you are used to work with (if any) to deal with requirements management?

Anyone but doors or osrmt?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved