C++ :: GF Flag Set - String Pooling Not Working?
Oct 20, 2013
I've created this little program.
#include <iostream>
int main(int argc, char* argv[]) {
char string1[] = "Hello";
char string2[] = "Hello";
[Code] ....
The idea, was to show that when you compile with the /GF flag set, string pooling is enabled, and the const char*'s which point to string literals would point to the same, read-only memory location. However, the addresses are still different.
Obviously, I'm compiling with /GF set. I'm using VC++2008 IDE if it makes a difference.
View 4 Replies
ADVERTISEMENT
Mar 13, 2015
I have 3 pages. I like to set a flag = TRUE when i'm in page3 and set flag = FALSE when i'm in page1 & Page2.
I tried like below,
I set the flag = FALSE in OnInitDialog & OnTimer of Page1 & Page2. and also set the flag = TRUE in OnInitDialog & OnTimer of Page3.
When i cross Page3 the the flag value changing both true/false when i'm in Page1.How is possible?
View 12 Replies
View Related
Apr 8, 2013
I just got this warning from codeblocks:
Code: extended initializer lists only available with -std=c++11 or -std=gnu++11 that I belive is due to having initialized a class array in the constructor somewhat like this:
Code: class xpto {
public;
xpto():num{25,25}{}
int num[2];
};
Since the code I'm developing is not meant to be compiled only by me and I want to ensure there are no incompatibilities with other machines I would like to kow whats the best way to initialize the array that is not c++11 dependent.
Is there no way to do it directly on the constructor "pre-instructions" (don't know the correct designation for the initialization section)? or do I have to put the instructions on the constructor body.
View 2 Replies
View Related
Dec 6, 2014
The function Reverse does seem to work. Its supposed to take the words in a sentence and then reverse them. For example: "This is nice" to "Nice is this." When I type "This is nice" I get " niceniceis nice"
#include <iostream>
#include <string>
using namespace std;
[Code]....
View 1 Replies
View Related
Oct 19, 2013
I want to alter a string inside a function, but it is not working.Here is the function:
Code:
#include <stdio.h>
void test (char *ch){
ch[0] = 0;
ch[1] = 1;
ch[2] = '';
}
[code]...
View 2 Replies
View Related
Feb 10, 2013
I created a .txt file that I called in.txt. It has the letters: a b c d e. I put it in the same folder as the c++ code below. I was hoping that I after I compile and run the code, the in.txt file would read: e d c b a. Unfortunately, it doesn't. Even when I give the ofstream file another name, it does not create another text file.
Code:
#include<iostream>
#include<fstream>
#include <limits>
[Code].....
View 7 Replies
View Related
Mar 6, 2015
Whenever I put my dll files in the same directory as my main.cpp and use this code, Code: g++ main.cpp -L. -lMyDll it works.
but if my dll files are in the other directory, Code: g++ main.cpp -L/myDlls -lMyDll it won't work. Why is this not working?
View 6 Replies
View Related
Jul 5, 2014
i am currently trying to get SDL working with C language.I am using Cygwin and Sublime text 2.I know and understand general programming, however i am trying to understand how to get SDL working with a file i create i.e test.c. i know to include which i have downloaded
#include <SDL.h>
where do i add the libraries so that i can use them in my program?
View 9 Replies
View Related
Apr 16, 2014
I am writing an irc bot in c++ on linux mint, and its not connecting right for some reason. anyways, heres the link: [URL].... . it was connecting to quakenet before I added the functions, but now it just says connecting... and then quits.
View 12 Replies
View Related
Apr 3, 2013
I'm learning network programming and I've decided to program a simple c++ irc bot. I'm able to connect to server and send commands. But when I try to receive and show message from server I first get a few lines, like "Please, wait, while we process your connection" or "Found your hostname". And then I start to get a ton of information about the server. Here is the whole class:
header file:
#pragma once
#include <WinSock2.h>
#include <WS2tcpip.h>
class bot {
public:
bot(char *_server, char *_port);
~bot(void);
[Code] .....
Link to whole visual studio project: [URL] .... Am I doing something wrong during the IRC connection? Or I didn't understand how networking work?
View 19 Replies
View Related
Jul 25, 2014
When inserting elements in a set it should only insert unique elements but I get duplicates too.
Code: #include <iostream> // cout
#include <algorithm> // unique, distance
#include <string>
#include <iterator> // std::back_inserter
[Code].....
View 3 Replies
View Related
Oct 21, 2013
Well for some reason this doesn't work.
Code:
#include <stdio.h>#include <ctype.h>
int main(void)
{
int lottoNums[150];
int num;
[Code]....
View 13 Replies
View Related
Nov 27, 2013
Code:
#include <stdio.h>
int main() {
int m,c;
for(c=0;c<100;c++) {
m = c % 10;
printf("%d ",m);
}
return(0);
}
When I run this code in my compiler, I get the first nine or ten numbers, and then after that it just spells out the letters in my name in different sequences over and over.
View 3 Replies
View Related
Mar 6, 2015
I'm trying to write a code that will
1) Generate a series of numbers
2) Write those numbers onto a txt file and
3) Read only the odd numbers out of the txt file.
I have 3 functions besides main that do each of the objectives individually and when separate they work just fine. But when I put them together for some reason the third function is never started. Also when I rearrange the 3rd function infront of the 2nd (since i have the txt file already saved) it works but I get an error when trying to close the txt file. It is the same close function that I'm using when first creating the txt file as well.
Here is the code
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
}
[code]....
View 3 Replies
View Related
Nov 19, 2013
I need to find out all the possible equations which are same of a given equation. For eg. a+b+c-d and b+c+a-d are same. So if the user inputs a+b+c-d then the output will be all the possible equations that can be formed from the given equation, viz:
a+c+b-d
c+a+b-d
-d+a+c+b
etc
i.e the program should rearrange the operands and operators in such a way that it should give the same result.
View 5 Replies
View Related
Aug 13, 2013
I have been coding this 2D physic engine for quite some time, I work on the many part of these 2 axis ( x and y ) in the same manner is just that one is an x and one is y
So there is a lot of duplicate code
If there is a bug in one part I have to fix the other axis too which becomes a hazzle because I have to fix the duplicates too. The sample code from my program
for( auto it =bodies.begin(); it != bodies.end(); ++ it ){
sf::Vector2f velocity = it->getVelocity();
if( velocity.x != 0 ){
// do some friction force calculation
[Code] ...
It is even more of a hazzle when I work with 4 quadrant, I have 4 duplicate code each ... How do I write a function for both axis ?
View 9 Replies
View Related
Jun 2, 2013
My SDL app which i made in visual c++ works properly on my pc, but it does not even starts on other computers. I have pasted all the required .dll files in my debug folder along with the pictures and sounds.
View 4 Replies
View Related
Mar 6, 2015
I have this case statement that is not performing as expected. For some reason ASE_OK and ASE_NotPresent both print out. Why is this? ASE_OK is a return value of 0 while ASE_NotPresent is -1.
Code: // Try to create the buffers and store it
switch (theAsioDriver->createBuffers(info, numChannels, bufferSize, callbacksInfo)) {
case ASE_OK:
std::cout << "ASE_OK";
input->bufferSize = output->bufferSize = bufferSize; // Buffer size is stored in both input and output
case ASE_NotPresent:
std::cout << "ASE_NotPresent";
errorMessage = "Could not find input or output devices.";
return NO_DEVICES_FOUND;
[code]....
View 3 Replies
View Related
Feb 3, 2015
I'm a bit stuck on a program that prints out a 8x8 chessboard and Q to represent queens where the user enters input. The intended output is: Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7
Q.......
...Q....
....Q...
Q.......
Q.......
.......Q
......Q.
.......Q
but instead I get Code: Enter the columns containing queens, in order by row: 0 3 4 0 0 7 6 7
.Q
.Q
.Q
.Q
.Q
.Q
[code].....
View 2 Replies
View Related
Aug 16, 2014
okay so like case 2 and 3 is not working, also the program is still not finish but why isn't case 2 and 3 not functioning well on the switch part? case 1 works just fine
Code:
#include<stdio.h>
main ()
{
//passcode part (passcode is 1234)
[Code].....
View 5 Replies
View Related
Jan 22, 2015
I have a program where the user inputs a line of numbers, and the two highest ones are displayed. It works fine, until negative values are entered at which point it shows 0 as the result.
Code: #include <iostream>
using namespace std;
int main( ) {
int num = 0;
int highest = 0;
[Code].....
View 6 Replies
View Related
Jul 26, 2013
I have created a project in netbeans 7.2 and have not modified any setting. I have used all sorts of methods I could think/find but the code can not find the file.
I have placed my test.txt file in the folder of the project. Here is the location of the file:
C:UsersSAMARASDocumentsNetBeansProjects
eadFi le
However, I could not use it without modifying it as an absolute path.
For example, check the code from the FAQ. //well the return 0; is missing but this is not the problem now.
Or for example this code Code: bad code or with Code: myReadFile.open("C:/Users/SAMARAS/Documents/NetBeansProjects eadFile est.txt"); I have tried many things for placing the slashes, but could not find the file.
View 6 Replies
View Related
May 14, 2013
Code:
#include <stdio.h>
#include <stdlib.h>
typedef struct BOOK
{
int* price;
} Book;
[Code] ....
View 1 Replies
View Related
May 26, 2013
I am writing a program that expands array list whenever they get too full...so far i have this:
Code:
#define DEFAULT 10
typedef struct ArrayList {
//array of strings
char **array;
[code]....
So, ArrayList *myList should return a pointer to the new arraylist or null if malloc fails. what exactly I need to set my maximum to, I know that it shouldn't be 0 and array[i] doesn't seem to be working either. I also am not sure if I am properly setting up null correctly for my array.
View 1 Replies
View Related
Nov 9, 2013
the functions checks if the word is a palindrome like"level" "madam" etc. but with input "dfdfdfdffdfd" my recursive function fails.
Code:
/* main.c - Created on: Nov 9, 2013 - Author: Kaj P. Madsen*/
#define MAX 100
#include <string.h>
#include <stdio.h>
int checkPalindrome(char checkString[MAX]);
int checkRecPalindrome(char checkString[MAX], int strLgt, int a);
}
[code]....
results from "dfdfdfdffdfd" added some print to see that its the variables a and strLgt not functioning properly
Code:
dfdfdfdffdfd.
The word is not a palindrome(iterative)
strLgt: 11 a: 0
a: d strLgt: dstrLgt: 10 a: 1
a: f strLgt: fstrLgt: 9 a: 2
a: d strLgt: dstrLgt: 8 a: 3
a: f strLgt: fstrLgt: 7 a: 4
The word is palindrome (recursive)
View 4 Replies
View Related
Dec 3, 2014
I have written a program to receive data from a client and log it in a file. But for some reason my SIGINT and cleanup function are not working. The server continues to run in the background.
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
[Code].....
View 3 Replies
View Related