|
|
|
|
hi!!!
my problem is that i don't know the code in C language that can save and edit file...............
i hope u will help me in this......please send the code at shazzney@message.com..........i'll wait for ur reply
thank you very much
-- modified at 3:17 Wednesday 25th January, 2006
|
|
|
|
|
this is the code for reading the text file which will help you
char temp1[80];
FILE *f;
if ( ( f = fopen("c:\\Log.txt","r") )==NULL)
{
printf("Unable to open file");
return;
}
while(fgets(f,"%s",temp1)!=EOF)
{
printf("%s",temp1);
}
fclose(f);
Thanks and Regards
Laxman
FAILURE is the first step towards SUCCESS 
|
|
|
|
|
thanks for that but can i ask the whole code of the program.
i'll wait for your reply..........
|
|
|
|
|
2 possibilities:
1. You need the complete code, you do not want to give it a try, feel free to send me the description of what you need, and i'll send you an estimation of what it will cost you.
2. You experience problems as every programmer now and then, post what you have already done, explain what the problem is, and we'll help on this forum.
~RaGE();
|
|
|
|
|
shazzney wrote: please send the code at shazzney@message.com
first of all, no way i do that, an i hope nobody will !! we are on this forum to share knowledges, so there is no reason that you get the answer secretly...
well, now, as your question is not very clear, i don't really understand what you're looking for. tell me if this is wrong :
- you code in C (not C++).
- you want to read/write from/into files, but don't know how ?
well, i may be wrong, but did you have a look at the fopen()[^], fclose()[^], fread()[^], fwrite()[^], fscanf()[^], fprintf()[^], fseek()[^] functions ?
there are plenty of them, just have a look on the MSDN...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
sorry if im to selfish but im thinking that the code is to long so i let u send in my email ad.
the code that i want to know is in C language. That can save, like in a cashier that can edit and save the remaining balance of the student.
i tell you frankly i dont know the code that is why im asking for help
|
|
|
|
|
|
shazzney wrote: my problem is that i don't know the code in C language that can save and edit file...............
Our problem is that you have not provided nearly enough details about the file in question. You're going to have to put forth some effort if you expect any reasonable level of help.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
On making my appl Unicode compatible(I add a _UNICODE defn among other preprocessor defn) d lpstrFile member of GetOpenFileName function OPENFILENAME param returns me just the selected file name instead of prepending d string with dir path.
How does defining _UNICODE affect the working of this function, and how does one resolve this problem??
Also I would like to hide the n/w btn on the placebar which im not able to inspite of the OFN_NONETWORKBUTTON option. Any suggestions on using this func 2 select multiple files w/o losing d explorer-style file browse dlg & placebar??
|
|
|
|
|
cpp_prgmer wrote: lpstrFile member of GetOpenFileName function OPENFILENAME param returns me just the selected file name instead of prepending d string with dir path.
Here I get the full path.
cpp_prgmer wrote: How does defining _UNICODE affect the working of this function, and how does one resolve this problem??
We must convert the file name to a Wide Character string using MultiByteToWideChar(...)
MultiByteToWideChar(CP_ACP, 0, ofn.lpstrFile, -1, pszFile, 512);
Jesus Loves <marquee direction="up" height="40" scrolldelay="1" step="1" scrollamount="1" style="background:#aabbcc;border-bottom:thin solid 1px #6699cc">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Sorry I guess you got me wrong. I have added _UNICODE among the preprocessor defn in d prj settings-> C++ tab, preprocessor combo value-> preprocessor directives.
Now the compiler interprets the ofn.lpstrFile as unsigned short * rather than char *.
So the question of conversion does not arise.
|
|
|
|
|
This works fine:
void main( void )
{
OPENFILENAME ofn = {0};
wchar_t szBuffer[MAX_PATH] = {0};
ofn.lStructSize = sizeof(OPENFILENAME);
ofn.lpstrFile = szBuffer;
ofn.nMaxFile = sizeof(szBuffer);
GetOpenFileName(&ofn);
wprintf(L"%s\n", ofn.lpstrFile);
} How does it compare to what you have?
cpp_prgmer wrote:
Also I would like to hide the n/w btn on the placebar which im not able to inspite of the OFN_NONETWORKBUTTON option. Any suggestions on using this func 2 select multiple files w/o losing d explorer-style file browse dlg & placebar??
The "My Network Places" button cannot be removed from the My Places bar, but it can be hidden. You'll need to modify the registry at HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Common\Open Find\Places\StandardPlaces.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Oh thanks David, actually I apologize for the mistake I made. I had set the lpstrFileTitle member also pointing to the same buffer which caused the prob.
Abt hiding n/w places option in d placebar, won't modifying d registry entry affect d working of other appl?? or is it dat ur hinting at temp. registry entry modification
Well how abt multiple file selection using the same func. OFN_ALLOWMULTISELECT is not supported and I want to have it using explorer-style dlg. Have i to think of a diff work-around for the same??
|
|
|
|
|
cpp_prgmer wrote: Abt hiding n/w places option in d placebar, won't modifying d registry entry affect d working of other appl?? or is it dat ur...
How about making an effort at spelling words correctly? Otherwise your posts are very hard to decipher. Even though folks might know the answer to a problem you are having, they might just refrain from sharing it with you simply because they feel you are not doing your part by forming a coherent sentence. No charge for that advice.
cpp_prgmer wrote: Abt hiding n/w places option in d placebar, won't modifying d registry entry affect d working of other appl??
Yes, it affects Office as a whole.
cpp_prgmer wrote: Well how abt multiple file selection using the same func.
Multiple files can be selected just as easily as a single file.
cpp_prgmer wrote: OFN_ALLOWMULTISELECT is not supported
Sure it is. Why would you think otherwise?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
A file is selected in explorer. I am able to get the selected file info using listview class "SysListview23". Now i want to get the selected file full path. SHGetPathFromIDList is not returning the full path. It is returning the path respective of desktop folder. How to get the full path of the selcted file/folder?
Please help me
Thanks,
Arumugarani Sundaram
|
|
|
|
|
If you know the pathname relative to the Desktop folder, then simply get the Desktop folder path (use SHGetFolderPath() ) and merge the two together.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Hi,
Thanks for your reply.
But this is not my expected result. I explain here the scneario once again.
(ie) The actual path of the file is : let it be D:\Samples\sample.txt. But SHGetPathFromIDList returns the path as "c:\Documents and Settings\username\Desktop\sample.txt". But what my requirement is i need the full path "D:\Samples\sample.txt".
I was able to get the same using GetWindowText of cabinet class. But what the problem is suppose if the user unchecks the option "show full path in titlebar" via Tools->folder options->view, then i won't be able to the fullpath.
If you know how to get the fullpath, please help me
|
|
|
|
|
I'm not understanding your definitions of "actual path" vs. "full path." What's the distinction? Is D: mapped to some folder on the C: drive? How are you acquiring the IDL?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I have a setup program and it registers various Components, (DLL's and OCX's) but a problem is caused only when the setup is trying to register FM20.DLL, the error code is 0x80040151. All other files are getting registered. How can I resolve this problem? In some machines there is no problem, but in some machines (98 specifically) this error comes.
Regards,
Aljechin Alexander
-- modified at 1:32 Wednesday 25th January, 2006
|
|
|
|
|
Can you register that DLL manually?
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
Respected All
I have used PRINTDLG in VC++ in my program.
now it work fine but when I changed the Orientation or some changes to print dialog it work accordingly but only once and when i have to print 2nd time my previous changes made to print dialog could not saved and default print dialog settings picked up unlike other window packedges like MS Word when we set the printer dialog settings then it is saved as long as the document is open.
now plz guide me that how i make my program that i personlize the printer dialog and my changes to printer dialog makes permonent as long as my VC++ program is running.
hope +ve response very soon.
david
|
|
|
|
|
void CSaveTextDlg::OnRead()
{
FILE *f;
CString temp1;
if ( ( f = fopen("c:\\Log.txt","r") )==NULL)
{
AfxMessageBox("Unable to open file");
return;
}
while(fscanf(f,"%s",temp1)!=EOF)
{
str= CString(str) + CString(temp1);
}
fclose(f);
m_Text=str;
UpdateData(FALSE);
}
This is my code...I got full text of Log.txt...But i got full text without space.I need space also.My text contains some tables..I cudn't get tht.
Pls findout the problem
|
|
|
|