C++ :: Filename Does Not Change

Sep 26, 2012

this is the code:

Code:
#include <stdio.h>
#include <string>
#include <iostream>
using namespace std;
int main () {
int result,i,j;

[Code] ....

and it doesn't find it. it says the the word:"Users" is incorrectly formed universal character name ....

View 2 Replies


ADVERTISEMENT

C++ :: Just Get Filename From Wstring?

Jun 15, 2012

I have a file path in a wstring like this:

wstring pathName = L"c:windowssystem est.exe";

I want to be able to geta new wstring that just contains "test" from this wstring.

How can I do that?

View 5 Replies View Related

C :: Passing Filename As A Parameter

Aug 23, 2013

Code:
#include <stdio.h>
void ASCII_to_EBCDIC( size_t, unsigned char *);
void EBCDIC_to_ASCII( size_t, unsigned char *);
void to_ASCII(unsigned char *);
void to_EBCDIC(unsigned char *);
/* conversion tables */
static unsigned char

[Code] ....

The above snippet is for a buffer/string, where as i want to pass file name as a parameter and want function to process the file line by line?

View 2 Replies View Related

C++ :: Insert Char To Filename

Sep 1, 2014

I have lots of files needed for program named text1,text2, etc. I tried to do a loop like this:

ofstream of;
for(char i='1';i<'9';i++)
{
of.open("text"<<i<<".txt");
}

I tried without << too, but it doesn't work neither. How can I make it work, without writing a line for each operation?

View 3 Replies View Related

C :: File Could Not Be Opened While Filename Seems Correct

Feb 10, 2013

I'm new to C and encountered a weird problem. Here's the code:

int main(){
char name[]="";
readname(name) ;
printf("The filename is: %s
",name);
printf(name);

[Code] ....

I compile this with no problem, but gives "File could not be opened". the strcmp tells me name and "snazzyjazz.txt" are not equal. but when I print them I get the same output.

View 2 Replies View Related

C++ :: CSV Parser - Infile Using Variable Filename?

Jan 18, 2013

So. I have a CSV Parser that I built. It works very well. The way it currently works is that I have the parser in a header file "CSV_Parser". So my .cpp code would look like this:

#include <iostream>
#include <eigen3/Eigen/Dense>
#include "CSV_Parser.h"
using namespace std;
using Eigen;

[Code] ....

This all works great. I am running Eclipse in Linux (Xubuntu to be precise). In the header file the .csv is opened as follows:

ifstream infile;
infile.open("/home/karrotman/Desktop/Matrix.csv");

What I would like is for the user to be able to change the file that the parser is opening through the main .cpp file. In other words, is there a way to create some variable, say "FileName" and do the following:

CSV firstMat;
string MatrixA = "/home/karrotman/Desktop/Matrix1.csv";
firstMat.extract(MatrixA);
CSV secondMat;
string MatrixB = "/home/karrotman/Desktop/Matrix2.csv";
secondMat.extract(MatrixB);

And then the .h would now say:

void extract(string FileName)
...
ifstream infile;
infile.open(FileName);

Obviously this does not work. Ultimately the goal is for me to open 4 .csvs at one time so I can do numerical operations on them.

View 2 Replies View Related

C :: File Contents Printing And Saving With Filename Whenever Try To Send

Jan 2, 2015

I am trying to establish a connection between client and server to send a file to the server from a client. I have been successfully able to send files to the server but i am facing a problem with the the filename whenever i try to send any string to the server and use it in naming the filename at the server side, the string is successfully concatenated but it saves the filecontents in the filename.

for example: i am sending a file hello1.txt to server and the server has to save it as abcxyz.txt as i am sending the "xyz" from the client. BUT Whenever i am doing this ,the file saves as abcxyzfilecontents.txt If i saved in the .txt file "you123" ,my file at server side would save as abcxyzyou123.txt

Here are my codes:

Know that the server code implements a multi threaded server. The functionality to be discussed is defined in myfunc

Code:
server.c:
#include <stdlib.h>
#include <stdio.h>

[Code].....

View 1 Replies View Related

C/C++ :: Writing To Text File With User Declared Filename?

Apr 21, 2014

I am wanting to have a text file which is named with the user input and appended with .txt.

cout << "Please enter a new filename for storing new coordinates in: ";
char name[50];
ofstream output;
cin.getline(name, 50);
output.open(name + ".txt");

Get an error with this code on ".txt".

View 2 Replies View Related

C++ :: Coin / Money Change Code Doesn't Give Exact Change

Feb 20, 2013

My coin/money change code works when there can be an exact change each time, i.e. when the 1 cent option is available. However, when the change options are only $10, $5, $1, 25 cents and 10 cents, it does not give me what I want for instance, I wanted to get change for $237.80, I was expecting to get:

23 10's, one 5, two 1's and 8 dimes. However, the code below is giving me 23 10's, one 5, two 1's and 3 quarters (there is no option left for the 5 remaining cents).how to fix it?

Code:
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void change(double cents, int a[]);
int main() {
double Dollars;
double cents;

[code]...

View 14 Replies View Related

C/C++ :: How To Open Filename Which Is In One Class And Then Use That In Different Class

Apr 20, 2012

I have written some c++ code in codeblocks but I am getting errors when i am trying to compile it. I have a file named files.txt and this file consists of the names of the files that actually contain the data that I need to present. I am trying to get the name of files from from once class and passing it through to another to process. These are the codes that i have:

main.cpp
#include <iostream>
#include <fstream>
#include <string>
#include "Files.h"
#include "Datafile.h"  
using namespace std;  
int main() {
    ifstream infile("fileListAug.txt");

[Code] .....

The error message that i get is error: no match for call to (std:: string). For ther line with the error I have used (*******Error points to this line).

View 4 Replies View Related

C :: Way To Change Font

Mar 6, 2015

how to use a keyboard. I have the program running now in Dev-C++, but the standard display letters on the monitor are small and sort of boring.Within a C program, is there a way to change the font to something stylish? Enlarge the letters? Change the color from letter to letter?

In the old days, there was graphics.h, but that isn't included now, and I would prefer to use some modern extension. I'd like to write it on Win7, then move it to Linux on Raspberry Pi. It would be nice to avoid a full-scale graphics system like OpenGL.

View 1 Replies View Related

C++ :: How To Change Nth Value In TXT File

Nov 14, 2013

I have a .txt file which contains a large amount of ones and zeros (tile map for a game) and basically I just want to know how to change say just the 12th value in the file from a 1 to 0 .....

View 2 Replies View Related

C++ :: Value In Loop Won't Change?

Sep 3, 2014

I am working on a program that is supposed to do I/O file streaming. I dont know if I can properly explain how its supposed to work but I have found the error on my code, I just dont know WHY the error is happening? If you look in the while loop, count changes values like it should, but MOVE and TIP doesnt. Count starts at value 2. So move is 108. Then count becomes 4, but move stays at 108?

tring rec;
fstream myfile("File.txt", ios::in | ios::out);
myfile.seekg(myfile.tellg(), ios::beg);
myfile.seekp(51, ios::beg);

[Code]....

The lines of code im getting errors on is

int move = count * 54;
int tip = move + 51;

Move wont change its value? It stays 108, causing this infinite while loop. Where is the error in my code to cause move to not change values like count does?

I seem to be struggling with I/O File streaming :(

View 2 Replies View Related

C++ :: How To Change Directory

Apr 24, 2014

How to change directory in c++ ( windows ) I want to go to the folder "example2" and I delete some files and then return to the original folder c++ - windows

View 7 Replies View Related

C++ :: Using Pointers To Change Some Value On The Fly?

May 13, 2015

I've got an interface that provides the methods that are to be implemented

Code:
class A {
virtual void A() = 0;
}
class B : public A {
std::string operator<<(const std::string& lhs);

[Code] ....

I don't know why the << operator in B is never called..

View 5 Replies View Related

C++ :: How To Change Font Size

May 19, 2013

how am i supposed to alter font size of text which appear in output screen?

View 1 Replies View Related

C :: Program To Change Name Of A Variable

Jun 15, 2013

if there is a program which i can use to change the name of a variable in a c program for example if i declare a variable like

Code:

int ch;
printf("%d", ch);

Can i later change the name of the ch variable to lets say "number" the code now becomes

Code:

int number;
printf("%d", number);

View 6 Replies View Related

C :: How To Change The Numbers Into Asterisk

Oct 10, 2014

i have my basic C program here (i'm new to C language):

Code:

#include <stdio.h>
int main()
{
int grade;
int A=0;
int B=0;
int C=0;
int D=0;
int E=0;

[Code]....

As you can see, it's only for counting how many students got the grades from A to E, but the problem is that i need to change it from numbers into asterisk

for example: 4 students got the grade A, and 3 students got the grade B

instead of displaying

A=4
B=3

i want it to display

A=****
B=***

View 11 Replies View Related

C# :: Change File Format

Jun 20, 2013

I have installed VS 2010 and VS 2012. VS 2012 uses SqlServer CE 3.5 and VS 2012 uses SqlServer CE 4.0.The problem is that when a project uses a 3.5 file it tries to open it with 4.0 even if the app.config says to use the 3.5 provider. The version of the assembly is pulled right out of the GAC. I uninstalled 4.0 and the reference auto updated its version to 3.5.1. However after installing 4.0 again it changes to 4.0. The error I am getting is that 4.0 cannot open a 3.5 file....they changed the file format from 3.5 to 4.0 and they are not compatible.

View 2 Replies View Related

C++ :: Any Way To Change Font Using Code

Dec 20, 2014

Is there a way to change the Font size using code?

View 5 Replies View Related

C++ :: Getting Optimal Change In Cents

Sep 4, 2014

On one of my assignments I have to find the optimal change. For example, if I were to have 70 cents and had only quarters, dimes and pennies, the best way to receive change using less coins all together would be 2 quarters and 2 dimes (4 coins all together should be displayed).

All in all, I understand my assignment, however there is something I don't know how to do (or can't recall how to) and that is finding the the highest number in an array to use in a function and be able to compare it.

#include<iostream>
using namespace std;
//function in which amount = money, changeArray is the array where money is stored,
//and numCoins the amount of coin types there are available in the array

int optimalChange(int amount, int * changeArray, int numCoins) {

[Code] .....

What I'm stuck with, is that I don't remember how to get the highest number from the array that way I can compare it with the total amount when I'm building my function. Also, the function has to call itself recursively.

View 1 Replies View Related

C++ :: How To Change Array To Dynamic

Sep 13, 2013

So this is the code I have so far, I didn't know it had to be a dynamic array so how would I Utilize dynamic array allocation to size the modal array

#include <iostream>
using namespace std;
int main() {
const int arraySize = 25;
const int patternSize = 10;

[Code] ....

View 1 Replies View Related

C++ :: How To Change Length Of Text

Oct 5, 2014

im new to c++ ,so my question is how do i change a length of a text. for example hi my name is blah blah blah. nice to meet you. (n i want every lines to have 8 chars how do i do that)

(hi__my__
name_is_
balh____
blah____
blah____
._nice__
to_meet_
you.) (_ equal space)

View 3 Replies View Related

C++ :: SFML 2.0 - Change Cursor

Sep 4, 2013

How to change what the cursor is in sfml 2.0?

View 1 Replies View Related

C++ :: Change Length Of Array Using GDB

Jun 16, 2014

I have a program with the following code, and I need to be able to either change the value of any or all of the strlen or to replace one or all with a temp array value. All values of the expression are arrays.

if (::strlen(tc_buf) + ::strlen(maxtime_buf) + ::strlen(" ") < sizeof(localBuf))

View 1 Replies View Related

C++ :: How To Change Values Of Array

Feb 1, 2015

how can i change the array value and display the updated value. for example this is the output beginning of the program

-----------------------------------------------------
Part Description Number of parts in the bin
----------------------------------------------------

valve 10
Bearing 5
Bushing 21
Coupling 7

[Code].....

View 1 Replies View Related







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