Click here to Skip to main content
15,917,062 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: rand ( ) Pin
John M. Drescher7-Aug-03 13:26
John M. Drescher7-Aug-03 13:26 
GeneralRe: rand ( ) Pin
Bob Stanneveld7-Aug-03 21:41
Bob Stanneveld7-Aug-03 21:41 
GeneralRe: rand ( ) Pin
Joe Woodbury7-Aug-03 12:23
professionalJoe Woodbury7-Aug-03 12:23 
GeneralRe: rand ( ) Pin
DaveE9th7-Aug-03 12:27
DaveE9th7-Aug-03 12:27 
GeneralRe: rand ( ) Pin
DaveE9th7-Aug-03 13:32
DaveE9th7-Aug-03 13:32 
GeneralRe: rand ( ) Pin
kochhar7-Aug-03 18:56
kochhar7-Aug-03 18:56 
GeneralRe: rand ( ) Pin
DaveE9th7-Aug-03 19:30
DaveE9th7-Aug-03 19:30 
GeneralCFile problem Pin
DougW487-Aug-03 11:21
DougW487-Aug-03 11:21 
Ok, I'm completely baffled. I am using a CFile to store information for my CDocument class in an SDI application and passing the CArchive to the serialize function. (We'll call the filename "datafile.dat") I have had absolutely no problems with my code up until this point. I am simply storing 4 CStrings in the file ("datafile.dat"). These 4 CStrings just hold locations of further files which the application will access. I am running into a problem when I try to open "datafile.dat" for storing...if any of the 4 CStrings is holding the address of a network file (a file on another computer) then "datafile.dat" will not open for storing. If the 4 CStrings hold the paths of local files or pretty much anything else, then "datafile.dat" has no problem and stores the information. Keep in mind, the location of "datafile.dat" is local and application specific...this file is not shared between multiple instances of my application.

I'm including my code snippet where I try to open the CFile for storing. This code works fine for all cases EXCEPT when one of the 4 CString variables (which is all that gets stored) contains the path of a network file instead of a local file. In the case of the network file path, the code gets stuck in the while loop. Oh, one other thing...the file DOES exist, it is created in the constructor if it doesn't currently exist, which by the time this code is reached, the file exists.


/* My Code for opening the file for storing. The FileName variable never changes after being initialized (I've message boxed it, the FileName variable isn't causing the InitFile to not open, it is the correct file at all times). */

CFile InitFile;
while ( !InitFile.Open(FileName, CFile::modeWrite | CFile::shareExclusive) );
CArchive archive(&InitFile, CArchive::store);
Serialize(archive);
archive.Flush( );
archive.Close( );
InitFile.Close( );




Thanks for taking to time to read such a long post, and I hope I was clear in my explanation, and that somebody understands why this file isn't opening! Confused | :confused:


Douglas A. Wright
dawrigh3@kent.edu
GeneralRe: CFile problem Pin
Bob Stanneveld7-Aug-03 12:13
Bob Stanneveld7-Aug-03 12:13 
GeneralRe: CFile problem Pin
DougW487-Aug-03 13:22
DougW487-Aug-03 13:22 
GeneralRe: CFile problem Pin
Ryan Binns7-Aug-03 13:30
Ryan Binns7-Aug-03 13:30 
QuestionHow to reset Timers Pin
gc_17-Aug-03 10:58
gc_17-Aug-03 10:58 
AnswerRe: How to reset Timers Pin
PJ Arends7-Aug-03 11:22
professionalPJ Arends7-Aug-03 11:22 
AnswerRe: How to reset Timers Pin
Jack_pt7-Aug-03 16:17
Jack_pt7-Aug-03 16:17 
AnswerRe: How to reset Timers Pin
Michael Dunn7-Aug-03 17:54
sitebuilderMichael Dunn7-Aug-03 17:54 
GeneralRe: How to reset Timers Pin
gc_18-Aug-03 9:02
gc_18-Aug-03 9:02 
GeneralAbsolute 0 - Boot Sector Pin
Like2Byte7-Aug-03 8:15
Like2Byte7-Aug-03 8:15 
GeneralRe: Absolute 0 - Boot Sector Pin
Nish Nishant7-Aug-03 8:24
sitebuilderNish Nishant7-Aug-03 8:24 
GeneralRe: Absolute 0 - Boot Sector Pin
Like2Byte7-Aug-03 8:29
Like2Byte7-Aug-03 8:29 
GeneralRe: Absolute 0 - Boot Sector Pin
Nish Nishant7-Aug-03 8:32
sitebuilderNish Nishant7-Aug-03 8:32 
GeneralRe: Absolute 0 - Boot Sector Pin
Michael Dunn7-Aug-03 17:58
sitebuilderMichael Dunn7-Aug-03 17:58 
GeneralError Pin
Zak_7-Aug-03 7:50
Zak_7-Aug-03 7:50 
GeneralRe: Error Pin
Maximilien7-Aug-03 8:03
Maximilien7-Aug-03 8:03 
GeneralRe: Error Pin
Like2Byte7-Aug-03 8:27
Like2Byte7-Aug-03 8:27 
GeneralRe: Error Pin
Michael Dunn7-Aug-03 18:16
sitebuilderMichael Dunn7-Aug-03 18:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.