473,544 Members | 1,833 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with dynamic fopen with windows mobile

1 New Member
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) {
printf("%d bytes read,error and eof values %d and %d\n\n",count,f error(file),feo f(file));

strcpy(filePath Ptr,"\\MyFilePa th\\data\\file0 01.mfr");
if((file = fopen(filePathP tr, "r") != NULL)) {
count = 0;
while((byte = fgetc(file)) != EOF) {
printf("File read with %d bytes and error values %d and %d\n",count,fer ror(file),feof( file));
if((file = fopen("\\MyFile Path\\data\\fil e001.mfr","r")) != NULL) {
count = 0;
while((byte = fgetc(file)) != EOF) {
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.
Aug 28 '07 #1
0 3360

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>...
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,...
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...
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...
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...
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...
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...
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...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
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. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
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...
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...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.