Hi I am having a problem and can not for the life of me figure out what is wrong.
I have a program that iterates through every file in a directory using FindFirstFile and FindNextFile and add them to a linked list. Then after adding all the files I want to read them in one at a time and send them over a socket connection.
I am succesfully iterating through all the files adding them to the linked list and retrieving them from the linked list but when I try and open them for reading using fgetc(filename) it ternminates prematurelly with error code 32 (ERROR_SHARING_ VIOLATION 32 ::The process cannot access the file because it is being used by another process. )
I looked long and hard for where the file may have been used by another process and not properly closed. In order to do that I added some debug statements and found out that if I open the file with a hardcoded name ie "fileName" and not with a char* that contains that file name everything works great. for example here is what I have
if((file = fopen("\\MyFile Path\\data\\fil e001.mfr","r")) != NULL) {
count = 0;
while((byte = fgetc(file)) != EOF) {
count++;
}
printf("%d bytes read,error and eof values %d and %d\n\n",count,f error(file),feo f(file));
}
fclose(file);
strcpy(filePath Ptr,"\\MyFilePa th\\data\\file0 01.mfr");
if((file = fopen(filePathP tr, "r") != NULL)) {
count = 0;
while((byte = fgetc(file)) != EOF) {
count++;
}
printf("File read with %d bytes and error values %d and %d\n",count,fer ror(file),feof( file));
fclose(file);
if((file = fopen("\\MyFile Path\\data\\fil e001.mfr","r")) != NULL) {
count = 0;
while((byte = fgetc(file)) != EOF) {
count++;
}
printf("\n\nAft er I could not read it can I still read? %d bytes and error values %d and %d\n\n",count,f error(file),feo f(file));
The printout looks like this:
115 bytes read,error and eof values 0 and 16
File read with 0 bytes and error values 32 and 0
After I could not read it can I still read? 115 bytes and error values 0 and 16
The only thing I can think of is for Windows Mobile 5.0 there is something wrong with passing in a standard char*. Is there another way around this, or has anyone experienced this before and found a solution or work around.
Thanks in advance I have been bashing my head against the wall on this one for awhile.
0 3387 Sign in to post your reply or Sign up for a free account.
Similar topics |
by: git_cs |
last post by:
Hey, guys and gals
Somedays ago, I had asked for the DES algorithm in C language.
Although I have written the algorthim in C myself, I am facing a
peculiar problem, which I hope some of u guys and gals solve.
I use Turbo C++ version 3.0 and WINXP as the operating system.
Pls observe the following program.
1 #include<stdio.h>
2 #include<conio.h>
|
by: Nick White [MSFT] |
last post by:
Hello fellow Microsoft Windows Mobile and Embedded enthusiasts:
I invite you to peruse the list below of upcoming technical chats and
Webcasts offered by the Windows Mobile and Embedded Devices Group.
For the full list of upcoming Windows Mobile and Embedded chats, to review
archived chat sessions, or to request a reminder for a chat, visit
http://msdn.microsoft.com/embedded/community/community/chats/. Also, the
Windows Mobile and...
|
by: Thomas |
last post by:
Hi,
I have written a Web Service using Axis C++ Server and a .Net Windows
client. I considered every interoperability issue between Axis and .Net(
Doc/Literal ...)
The .Net Windows client can communicate with Axis without any problems. Now
I want to use my Web Service on a windows CE pocket pc but the problem is
that .Net don't create a client stub that can be compiled. If I try to
compile in .Net the following errors occur:...
|
by: zaebos |
last post by:
hi, i have this code which is part of a main program, to email from
within the program a log file:
int MailIt (char *mailserver, char *emailto, char *emailfrom,
char *emailsubject, char *emailmessage) {
SOCKET sockfd;
WSADATA wsaData;
FILE *smtpfile;
#define bufsize 300
|
by: yanlu06 |
last post by:
I tried to use HTML2FPDF to generate dynamic local files and save the
generated files on the server. I don't know why it gives me the
following error message:
" Warning: fopen(gen_pdf/gen_pdf/yan.pdf) : failed to
open stream: No such file or directory in
/export/home/.../pdfCov/fpdf.php on line 1698
FPDF error: Unable to create output file: gen_pdf/yan.pdf "
I cut and paste the following part of the code into a test.php file and
| |
by: =?Utf-8?B?am8uZWw=?= |
last post by:
Hello All,
I am developing an Input Methop (IM) for PocketPC / Windows Mobile (PPC/WM).
On some
devices the IM will not start. The IM appears in the IM-List but when it is
selected from the list athe result is that the standard (QWERTY) keyboard
appears.
I found that many ( all?) ISV's who make IM's have customers reporting this
problem. My research on the internet brought me to the conclusion it is some
|
by: julie.siebel |
last post by:
I'm working on a rather complex booking system for building European
trips, in a combination of SQL/VBScript/Javascript. There are tons of
query string variables that get passed back and forth between the
pages, and in almost every case, I can set 'em up fine, provided the
variables are in the link.
The page the *holds* the booking information, though, is problematic.
An example trip might include two European cities or towns with a...
|
by: libish |
last post by:
hi all,
can any one help me to create dynamic forms in windows mobile application.
here in my application, i'm requesting a server response, and the server response contains directions for the GUI's . here i need to add forms, and within that form i need to add menus, labels, list etc... according to the response.
can any one help me to get this done...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |