Visual C++ :: CArchive Load Gives Null Lines
Aug 1, 2013
I am trying to reuse some code from my Visual C++ 2005. I am using CArchive to ReadString the first line of a file into another string. However, I am seeing squares where there should be spaces when I view it in the debugger.
Here's the code:
if( cfSAP.GetStatus(csRegExtractFileRemote, cfsStatus)) {
if( !cfSAP.Open( csRegExtractFileRemote, CFile::modeRead, &ef ) ) {
cout<<"FAILED
"<<endl;
ef.ReportError();
[Code] ....
I am not able to read the lines due to this bug ,
This is normal text file contains two lines of information like this
0234568374C186-M-233545 SHAFT MATNUMBER1
0234564565C153-C-349578 BRACKET MATNUMBER2
View 4 Replies
ADVERTISEMENT
Jan 18, 2013
I have a Visual C++ workspace that has 2 projects (1 exe & 1 DLL). I used Serge Wautier's tutorial [URL] .... to create (multi-language) resource DLLs (satellite DLLs) branching off the exe.
Now I have a collection of strings in the DLL that are shared in other projects. I created a satellite DLL for that DLL but can't figure out how to load it on-demand just like the exe's satellite DLL.
He used:
HINSTANCE hDll = LoadLibrary(szFilename);
AfxSetResourceHandle(hDll);
void CLanguageSupport::UnloadResourceDll() {
if (m_hDll!=NULL) {
SetResourceHandle(AfxGetApp()->m_hInstance); // Restores the EXE as the resource container.
FreeLibrary(m_hDll);
m_hDll= NULL;
}
}
etc etc ... for the unloading/loading satellite DLLs for the exe. But how to do the same for the DLL?
View 5 Replies
View Related
Dec 19, 2012
I need to open up and modify a user's registry key from a 32-bit service (note that the user is not logged in at the time.) I do the following:
Code:
//For simplicity error checks are not shown
//I also made sure to enable the following privileges:
// SE_RESTORE_NAME, SE_BACKUP_NAME
[Code]....
The problem is that the "SoftwareClassesLocal SettingsSoftwareMicrosoftWindowsCurrentVersionTrayNotify" key isn't loaded, even though I know that it exists in the actual user profile. I can verify that by loading the user account and by using 64-bit regedit.
View 5 Replies
View Related
Nov 22, 2012
I am working to load CoInitialize using getprocaddress, but I don't know why this function fail and cash program! It didn't happen with other functions in other libraries like kernel32.dll. Here is my test :
Code:
typedef HRESULT (*pf)(LPVOID);
pf rf = (pf)GetProcAddress(LoadLibrary(ole32.dll), "CoInitialize");
CoInitialize(NULL); // This line crashes the program!!
why and how to properly load it ?
View 1 Replies
View Related
Apr 15, 2013
I am doing an exercise that reads in a text file and loads the data into a struct. My problem is it doesn't read anything from the text file. I think it's the way I'm loading the data. Oh, it does read in the first record that tells the program how many contributor records to create, but nothing after that. Here it is:
Code:
//
#include <iostream>
#include <fstream>
#include <cstdlib>
const int strsize = 30;
const int SIZE = 60;
struct contributions {
char fullname[strsize]; //name
double donation; //donation
[Code] ....
Here is the record input:
Data file:
4
Suz Stuz
55000
Froco Frock
5000
Yandi Yuck
100500
Dippy Dip
120000
9 records - each struct has two members; full name and donation. First record should be number of contributors ...
View 12 Replies
View Related
Dec 31, 2013
I dumped all symbols into C:WindowsSymbols folder, It takes more than 2 minutes to load an application which really surprises me. Why and when should I use those symbols?
View 1 Replies
View Related
Feb 25, 2014
I'm using the Feature Pack CTabView, and I noticed that when the view is added using AddView with the following code CView's HWND is NULL when I try and access each of the CView1,CView2, etc.
Code:
int CMyTabView::OnCreate(LPCREATESTRUCT lpCreateStruct) {
if (CTabView::OnCreate(lpCreateStruct) == -1)
return -1;
AddView (RUNTIME_CLASS (CView1), _T("Simple"),100);
AddView (RUNTIME_CLASS (CView2), _T("Pair"),101);
AddView (RUNTIME_CLASS (CView3), _T("Data"),102);
return 0;
}
I think the user has to click the view's tab before the CTabView assigns an HWND. Is there a way to force CTabview to give each CView an HWND when the view is added?
View 11 Replies
View Related
Jan 23, 2013
Code:
while(!pile.eof()){
pile.getline(inputbuff,199,'
');
count++;
[Code] ....
the loop iterates the first time through qualifying for (count % 2 != 0) because count is at 1 so it stores the characters after the comma into tok and does it successfully according to my debugger.then the while itterates again because it doesn't qualify for the next if. this time it does qualify for count % 2 == 0 but my tok pointer is now null , how can that be? does it go null when the while loop itterates for the second time? that shouldn't be because my integer count doesn't reset?
View 4 Replies
View Related
Feb 18, 2014
I am looking at one of the functions of an exercise:
void escape(char * s, char * t) {
int i, j;
i = j = 0;
while ( t[i] ) {
/* Translate the special character, if we have one */
switch( t[i] ) {
[code]...
Notice the while loop evaluates the current value in t to true or false. When we hit the null terminator, does that get evaluated as 0 and hence evaluates as a falsy value so the while loop exits?
View 1 Replies
View Related
Mar 17, 2013
I have a file that is like the following, with patterns of pipes in it:
Code:
||| || | |
| ||| | | |
|| || ||
I have to consider each row of pipe characters to be in blocks of 3 characters each (e.g. - positions 1-3, then 4-6, etc, etc...) but I have to capture all of the pipes, in sequence, like so:
positions 1-3 for lines 1-3, then positions 4-6 for lines 1-3, etc, etc...
How to get this done besides writing severely redundant control structures like loops, one after the other?
View 5 Replies
View Related
Nov 28, 2012
I have a file that contain different content, some lines inside that file looks like that :
Time : xx:xx:xx
Time : xx:xx:xx
So, I want to grab lines that start with "Time : " and put them inside a list<string> for later use. I am using windows so I don't know if the newline character is '
' or '
' also I don't want my grabed line contain any special character.
I have this code, but didn't work well because some special characters remain inside the string.
Code:
string buf;
list<string> ls;
ifstream read("test.txt", ios_base::binary);
while(!read.eof())
{
getline(read,buf,'
[Code]...
View 1 Replies
View Related
Jul 28, 2013
I am writing a pure C based win32 applications. I have drawn line. Now i want to translate that line, move the line whereved user wants to move on screen. Then again I drawn another line, I am drawing multiple lines.
I have created rectangle region for each line and trying to move the line.
When I move the 2nd line over the 1st line on screen the 1st line is getting wiped out. Because I am InvalidateRect() of the rect for the line being moved, so when that rectangle is crossing the other line then the other line is getting removed from the screen.
How can I rectify it. How can I have all the lined being on the screen and moved according to the user's wish. The code should be pure C and win32 no MFC.
View 4 Replies
View Related
Oct 15, 2013
I am trying to print a specific line from a textfile
e.g
I have a text file called info.txt and inside it contains the id,item name, price, quantity
Code:
1,shirt,100,10
2,pants,50,9
3,pen,20,8
I know how to find a specific word at the line in the file but how do I find and print out the specific line e.g(print out just the entire contents of line 2)?
Code:
string temDescription;
ofstream fout;
int curLine = 0;
[Code].....
View 1 Replies
View Related
Feb 7, 2015
I'm making some progress. My program does compile and output the number of line per code, but it shouldn't count comments and blank lines. I tried using (s.substr(0,2) == "//") as suggested but it didn't work.
This is my improved code:
Code:
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
const int A = 3;
int main() {
string s;
[code].....
View 1 Replies
View Related
Feb 3, 2014
I am facing a programming logic problem. I want to draw radius sized lines from centre of circle to the circle boundary.
My code is:
int x1, y1, x2, y2, i, r, old_xc,old_yc, x,y;
int xc, yc;
x1=170;
y1=300;
x2=70;
y2=400;
pDC->Ellipse(x1,y1,x2,y2);
[Code] .....
The lines are touching the circle boudary at only start while the rest of lines are smaller and the shape is a triangle instead of a pie slice.
View 8 Replies
View Related
Mar 31, 2015
When you login to my site my loginservice which is done by ajax and json make a session called context.Session["Name"]. With BreakPoints it shows that everything is good and the variables are in place. However when I use Session["Name"] it comes out as null.
I will add my code at the bottem not
using System;
using System.Collections.Generic;
using System.Linq;
[Code].....
View 2 Replies
View Related
Mar 4, 2013
What I have to do is write a small program in C++ to parse the symbols that are used on 5 different lines of text in each position until position 30 is reached on each line. The goal of the parsing program is to interpret the symbols (characters), if there are any per each position, on the 5 lines of text in order to output the actual data that the group of symbols represents.
My question for is this: Is there anything special from a C++ environment that should go in to something like this outside of using standard stuff like the math associated with the search algorithm that has to happen here? The symbols are located in a file, so I know I have to include "iostream" and a few other headers. But outside of header inclusions and the code necessary to iterate and streamline the search and interpretation process, am I missing anything special that I couldn't otherwise find through simple google searches?
View 6 Replies
View Related
Sep 26, 2013
Let's say I create a small program or just want to open any kind of file on my computer, but I want to run a program that forces the user to enter a password or something (I already know this part). How does one create the code that would open the file?
View 5 Replies
View Related
Nov 26, 2013
I am trying to put my Save and Load function in my game, this is what i have:
Code:
/* Save game */
void GuardarJuego() {
FILE *fsave;
char turno;
fsave=fopen("SAVE.txt", "w");
fputs(*****, fsave);
[Code] .....
My game code is this: [C] GameCode - Pastebin.com
View 8 Replies
View Related
Apr 8, 2013
I don't mean how do I load a bmp, I mean how does SDL manage to do this?
View 2 Replies
View Related
May 24, 2014
I'm trying to load a PNG image to use as texture, but when I compile the sdl window closes. I'm sure the error is in the function of generating the png texture, because when i donĀ“t use this function, the sdl window does not close. So debugging using cout i found that the cout above glTexImage2D function, shows in console, but the cout in below of glTexImage2D does not work. Does not reading this image?
hear is the function
#include "Texture.h"
#include <iostream>
Texture::Texture() {}
[Code].....
View 9 Replies
View Related
Dec 29, 2014
i have made this first level in this ascii game, and i realized that if i want to continue, i must rewrite the switch statement and write thousands of lines of code. how can i load a map from a txt file?
#include <iostream>
#include <windows.h>
using namespace std;
[Code].....
View 3 Replies
View Related
Mar 22, 2014
I am trying to run a console program but for any reason it displays an error on the cv.h line.
View 5 Replies
View Related
Apr 17, 2014
I'm working on a project, and I'm trying to fill in various vectors from a given input file. The input file looks like:
<catalog>
<book id ="bk101">
<author>O'Brien, Tim</author> ....etc
My load vectors function looks like this: void load_vectors(vector<string>&id, vector<string>& author...etc)
I can't assume a limit on the number of books etc listed in this catalog, so I'm using the eof() function. However, I don't know how to write the loop to gather the correct strings and place them in the vectors.
Code: while(in.eof())
{ string text;
int index, index2;
getline(in, text);
int index = text.find("<author>");
int index2 = text.find("</author>");
a = index.lenght();
author.pushback[i] = text.substr(index + a, index2);
}
View 3 Replies
View Related
Feb 16, 2014
How to read dll files and i came up with this:
// DLL
Main.h:
#ifndef _MAIN_H_
#define _MAIN_H_
#include <iostream>
#include <stdexcept>
#include <fstream>
_declspec(dllimport) void testfunc( int a );
[Code] .....
Out: testfunc == NULL
What went wrong here?
View 2 Replies
View Related
Apr 18, 2014
How to load png files and extract their rgb pixels? Library recomendations?
View 2 Replies
View Related