|
Hi Thanks for yuor reply.
How can i sort the text file using C++ code.
If you have any piece of code please expain me with that
|
|
|
|
|
neeraja31 wrote: How can i sort the text file using C++ code.
The qsort() function provides a simple sort mechanism, or you could use the STL vector<> type. See the MSDN documentation for complete details.
|
|
|
|
|
neeraja31 wrote: How can i sort the text file using C++ code.
How about std::sort() ?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
read text lines from file and save them to vector(or other container),
then sort the vector and unique it.
|
|
|
|
|
Please give me te\he piece of code to read from vector, confirm me whether that will work on win32 VC++ project
|
|
|
|
|
One example, assuming you are storing int s in the vector , looks like:
vector<int> nums;
for (vector<int>::iterator i = nums.begin(); i != nums.end(); i++)
cout << *i << endl;;
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi sir..
I have created one dialog based application.when i am trying to add new member variable.It is giving the error as..
Error: object does not support this property or method
"file:///C:/Program%20Files/Microsoft%20Visual%20Studio%208/VC/VCWizards/CodeWiz/MFC/Simple/HTML/1033/default.htm"..
I have installed IE8 but i am getting the same error.
any help will be thankful..
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
sharanu wrote: I have created one dialog based application.when i am trying to add new member variable.It is giving the error as..
Error: object does not support this property or method
What is the structure of your object, and how are you adding the new member?
sharanu wrote: I have installed IE8 but i am getting the same error.
What does this have to do with a dialog based application?
|
|
|
|
|
File system may be NTFS, FAT32, compressed or not, my question is:
when a software was installed on different OSs, Are file sizes the same under different operating systems?
i.e. the installation pack has following files: myexe.exe, myhtm.htm, mychm.chm, mytxt.txt and other types of files, do all files appear the same in sizes under different operating systems?
|
|
|
|
|
includeh10 wrote: Are file sizes the same under different operating systems?
Yes and No.
The actual size of a file in bytes will remain constant throughout the known universe; as long as 1 byte == 8 bits remains true.
However the size of the file on a storage medium (disk, DVD, memory stick etc.) varies according to the device sector size. For example if a disk has a sector size of 28 bytes then a file of 100 bytes will take up 4 sectors: 3 full sectors, plus 1 extra containing the last 16 bytes. This will give an apparent file size of 112 bytes. If the filesystem uses compression then the size on disk cannot be calculated accurately, although the file system will still return the correct size uncompressed.
|
|
|
|
|
My post is not clear according to your reply.
Exactly say:
- all files are only on harddisk (installed there)
- Functions used for calculating file size are:
- FindFirstFile(...)
or dwFileSizeLow of struct WIN32_FIND_DATA
- GetFileSize(...) or GetCompressedFileSize(...)
related to OpenFile(...)
If so, the answer is "Yes" or "Yes and No"?
modified on Sunday, September 27, 2009 8:41 AM
|
|
|
|
|
The documentation[^] says "The GetFileSize function retrieves the uncompressed size of a file. Use the GetCompressedFileSize function to obtain the compressed size of a file."
|
|
|
|
|
harold aptroot, thanks.
I modified my question.
My question is if file size obtained by functions is the same for same file installed on different OS.
I can not test, because I don't have all different OS.
|
|
|
|
|
Well it should be the same
I won't make any guarantees though, windows can be very odd..
|
|
|
|
|
includeh10 wrote: My question is if file size obtained by functions is the same for same file installed on different OS.
How important is it to know this? Since each OS provides a function to return the size of a file, then it will always return the file size on that specific OS.
includeh10 wrote: I can not test, because I don't have all different OS.
Then why do you need the information?
|
|
|
|
|
Hi sir.
I have prepared one dialog based application.If i click a button .I want open a doc file.
for example: Suppose their is a doc file in "D:\sample.doc".The document file must open.
thank you
sharan
Hi,,
I am sharan.Working as a software Engineer in Indo-Fuji Software Company located in BTM Layout.Bangalore.India.
I have Completed my B.E(COmputers)in 2006.ANd I am having 2 years of Exp in VC++.
thanking you
sharan
|
|
|
|
|
|
Did you try using CStdioFile?
In another way, you can using CFileDialog to access File Common Dialog from your application.
I hope, those can help you...
|
|
|
|
|
Im tying to cat an integer, such as zero. I am basically trying to count from "0000000" to "99999999" but everytime I set 'int i = 00000000" it shows up as just '0' how can I set the start value as '00000000', so that it will count as "00000001, 00000002, 00000003" and so on?
I figure if it is only going to count as zero, I guess I should count the number of values that it has counted and cat the zeros on to it. The first start was to set and array as "unsigned long int aArray[] = {0,00,000,0000};"" and so on, but that doesnt work.
|
|
|
|
|
For an integer, 0 or 00 or 000 etc. are all the same.
What you're saying is the way you want to visualize it.
That can be done while printing using printf.
printf("%07d", ival);
Or while converting it to a string in MFC.
CString cs;
cs.Format("%07d", ival);
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
is there a way to output visually using namespace std;, I havent used printf in forever
|
|
|
|
|
Try this:
int main()
{
for (int i=0;i<10;++i)
std::cout << std::setfill('0') << std::setw(7) << i <<std::endl;
}
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
haha I remember seeing "setfill" around somewhere, I just never thought of it. Ty so much the works hella. ty
|
|
|
|
|
If you mean using C++ streams, you should be able to it like this -
cout << setw(7) << setfill('0') << ival;
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
I got it all worked out, my overall output is:
#include "stdafx.h"
#include <conio.h>
#include <iomanip>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
unsigned long int o = 99999999;
for (int i=0;i<o;++i)
cout << setfill('0') << setw(9) << i << endl;
getch();
return 0;
}
|
|
|
|