Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I am new in c++. I tried to create the binary file in c++. But not able to create it.Below is my source code.
void main()
{
ofstream myfile;
myfile.open("D:\get\data.bin",ios::binary);
if (myfile.is_open())
cout<<"hi"<<endl;
else
cout<<"bye"<<endl;
}
I always get bye output only.
My required target is to create a binary file in D directory with the data as a file name.I am using VS2010 and os is win 7.
for providing the help
You have to double the backslashes :
"D:\\get\\data.bin"
Have a look at escaped characters.
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I want to check if a String contains a specific Text.
Something like this
CString a;
CString b;
if (a.Find (b))
{
String a contains String b
}
Can anyone help me? Im working with mfc
If you change your if statement to
if (a.Find (b) != -1)
then you get what you want.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to call from a program in VS2010 C++ a windows application using a system call.
How is that possible in Windows? I would like to compress a file using the 7z applicaition. Can I call it from the VS2010 program?
The command is: C:\Program Files\7-Zip>7z a -mx9 -tbzip2 zip1.bz2 History.txt
Thank you
You can use
http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153%28v=vs.85%29.aspx
or
http://msdn.microsoft.com/en-us/library/windows/desktop/ms682425%28v=vs.85%29.aspx
or
http://msdn.microsoft.com/en-us/library/windows/desktop/ms687393(v=vs.85).aspx
or
call system() function
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I would like to find a word in a text file, and save it to a variable along with some characters. for example in the text file it would be something like:
Isoelectric Point = 6.2505
I'll be looping through a directory of files, so the value of the Isoelectric Point will change, and that is why I need the characters after the match to be saved to a variable.
if (my ($point) = $str =~ /Isoelectric Point = (\S+)/) {
...
}
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
What is the best way to transform a string with a special template, like a sed unix transform.
i must to do this with QT c++ :
original string : 00048500854006F85FF4B0
before c++ transform : 48500854006F85FF4B
Eliminate all the 0 in the start and the end of my string (not in the middle).
maybe a solution with sprintf ?
thank you very much for your help.
It's possible to do using regular expression:
QString("00048500854006F85FF4B0").remove(QRegExp("(^(0)+)|((0)+$)"));
You can always use the power of sed by calling system ("sed 's/foo/bar/' file"); or by using the Qt QProcess. In that case see this and this
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
#include<fstream>
int main()
{
ifstream fFeedList;
fFeedList.open("/ra/file");
return 0;
}
How to read files with .bz2 in C++? Thanks!!
Take a look at the Boost iostreams library, it can decompress bzip etc.