|
HELLo
i 'm fresher in vc++.
i am making a module there are some problem occure.
1.How can i split the window in two part.
2. how can i open a dirctoty listing such as appear in window.
e.g we click the browse buuton and conent of drive appear
3.and how cna i find the current path.
4. how can i set the default path
5.What f() is used for search a file or diredtory.
i would be very thankful.
Parshant
|
|
|
|
|
Parshant Verma wrote: 1.How can i split the window in two part.
Use a splitter window. If you are using MFC, check out CSplitterWnd .
Parshant Verma wrote: 2. how can i open a dirctoty listing such as appear in window.
Are you referring to SHBrowseForFolder() ?
Parshant Verma wrote: 3.and how cna i find the current path.
4. how can i set the default path
Check out GetCurrentDirectory() and SetCurrentDirectory() respectively.
Parshant Verma wrote: 5.What f() is used for search a file or diredtory.
Use the FindFirstFile() /FindNextFile() pair. MFC has a CFileFind class.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Parshant Verma wrote:
1.How can i split the window in two part.
Ans: Use CSplitterWnd
Parshant Verma wrote:
2. how can i open a dirctoty listing such as appear in window.
Ans: Get the contents of the folder and then show it in a tree view(This could be only one of the options.
Parshant Verma wrote: 3.and how cna i find the current path.
3. Use GetModuleFileName()
Humm!, Hurry spoils The Curry....
use GetCurrentDirectory() .Thanks David....
Parshant Verma wrote: 4.and how set the default path
4. Not sure what you are asking for.
Parshant Verma wrote: .What f() is used for search a file or diredtory.
5. FindFirstFile(), FindNextFile(), WIN32_FIND_DATA
-- modified at 9:06 Wednesday 30th August, 2006
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
_AnShUmAn_ wrote: 3. Use GetModuleFileName()
GetModuleFileName() is used to get the fully qualified path for the specified module. This is not the same as the current path (i.e., directory).
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
maybe it is some helpful to you
(1) search codeproject for splitter window
(2)
<br />
BROWSEINFO bi;<br />
TCHAR szDisplayName[MAX_PATH];<br />
szDisplayName[0]='\0';<br />
memset(&bi, 0x00, sizeof(bi));<br />
bi.hwndOwner = this->m_hWnd;<br />
bi.pszDisplayName = szDisplayName;<br />
<br />
bi.ulFlags = BIF_EDITBOX;<br />
bi.lpszTitle=lpc;<br />
LPITEMIDLIST pidl = SHBrowseForFolder(&bi);<br />
if (pidl)<br />
{<br />
SHGetPathFromIDList(pidl, szDisplayName);<br />
if(lstrlen(szDisplayName)>0)<br />
return szDisplayName;<br />
}<br />
(4)Set/GetCurrentDirectory();
(5)
WIN32_FIND_DATA find;<br />
HANDLE handle=FindFirstFile("*.*",&find);<br />
while(FindNextFile(handle,&find)!=0)<br />
if(find.cFileName==yourstring);<br />
m_ListAddString(find.cFileName);<br />
FindClose(handle);<br />
|
|
|
|
|
|
Hell, why don't we just wipe the CP server and hand the space over to MSDN? Sure they coudl use it to hold allllll of those answers.
|
|
|
|
|
then, let's close this forum...
|
|
|
|
|
Please help me to create an array which is coming from txt file...
Here is my code so far...
#include "stdafx.h"
int _tmain(int argc, _TCHAR* argv[])
{
FILE *input; // declare a pointer of type FILE
char input_char; // a single character
#define width 15
#define height 40
char buffer[width][height]; // a buufer array
int n,m;
// ******** open
input=fopen("D:\\Documents and Settings\\wzq2gn\\My Documents\\Old pc\\Ferdy's File\\Lecture 3 Examples\\customer.txt","r");
for (n=0;n
|
|
|
|
|
And what exactly is the problem ??
Also, use the pre or code tags (just above the emoticons) when you post code. And don't forget to replace the < and > symbols in your code by the tags also (or you can select 'Ignore HTML tags')
|
|
|
|
|
|
Your code snippet would be that much more readable had you enclosed it within <pre> tags.
So what is the problem you are having?
wzq2gn wrote: buffer[n][m]=fgetc(input);
It'd be much more efficient to at least use fgets() , rather than read one character at a time.
wzq2gn wrote: printf("%c,%c ",buffer[n][m]);
This tells printf() to print two characters, but you are only supplying one.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I need to use the fgetc for single character manipulation.
How do I get the contents of the array using printf?
|
|
|
|
|
wzq2gn wrote: I need to use the fgetc for single character manipulation.
Using fgetc() is very costly in terms of disk I/O. The fact that you need to do "single character manipulation" has nothing to do with using fgetc() . You could read the entire file into memory using one call to fread() and then operator on the character buffer.
wzq2gn wrote: How do I get the contents of the array using printf?
printf() is used to print, not get. The format string governs how many variable arguments are passed to it. In your code snippet, you were only passing one, but two were required.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Do your requirements require a C-style implementation? That is, why not use the standard C++ libraries?
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Your code was incomprehensible and you didn’t explain properly what you were trying to do so I took a guess. You should spend some more effort making you code intelligible, especially if you’re asking others to look at it. Anyway forget about old C functions such as “fgetc” and raw arrays. Here’s my program in C++:
----------------------
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
int main(int argc, char *argv[])
{
using namespace std;
// Open the input file.
ifstream iff("C:\\a.txt");
if (!iff)
{
cerr << "Failed to open input file!" << endl;
return 1;
}
// We'll store the file's contents in a 'vector' of 'string's.
typedef vector<string> FileContents_t;
FileContents_t fileContents;
// Read in the file line by line and add each line to 'fileContents'.
string line;
while (getline(iff, line))
{
fileContents.push_back(line);
}
// Now we can access any character in the file by its row and column.
unsigned int column = 5;
unsigned int row = 4;
if (row>=fileContents.size())
{
cerr << "Row out of range!" << endl;
return 1;
}
const string &ourRow = fileContents[row-1];
if (column>=ourRow.size())
{
cerr << "Column out of range!" << endl;
return 1;
}
char c = ourRow[column-1];
// Output the results.
cout << "Char at row " << row << " column " << column << " is " << c << endl;
return 0;
}
Steve
|
|
|
|
|
Thanks Steve and all the people who contributed for my C++ fiasco...
|
|
|
|
|
hi all,
CMAPIAdviseSink::OnNotify(...) will give the notification of email, Please let me know the steps to be followed to get the Notification of Messages when a Mail is Send to your computer.
Uday kiran
|
|
|
|
|
See here.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi!
How can I take path to current folder.
Example.
I rum my program from c:\Program\Demo\
How can I take this path.
|
|
|
|
|
|
maybe I should hit my refresh button more often :p
|
|
|
|
|
.... LOL .....
Regards
Programm3r
|
|
|
|
|
Work
Tank You very much!
|
|
|
|
|